Class: GLI::Commands::HelpModules::FullSynopsisFormatter
- Inherits:
-
Object
- Object
- GLI::Commands::HelpModules::FullSynopsisFormatter
- Defined in:
- lib/gli/commands/help_modules/full_synopsis_formatter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(app, flags_and_switches) ⇒ FullSynopsisFormatter
constructor
A new instance of FullSynopsisFormatter.
- #synopses_for_command(command) ⇒ Object
Constructor Details
#initialize(app, flags_and_switches) ⇒ FullSynopsisFormatter
Returns a new instance of FullSynopsisFormatter.
5 6 7 8 9 |
# File 'lib/gli/commands/help_modules/full_synopsis_formatter.rb', line 5 def initialize(app,flags_and_switches) @app = app @basic_invocation = @app.exe_name.to_s @flags_and_switches = flags_and_switches end |
Instance Method Details
#synopses_for_command(command) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gli/commands/help_modules/full_synopsis_formatter.rb', line 11 def synopses_for_command(command) synopses = [] one_line_usage = basic_usage(command) one_line_usage << ArgNameFormatter.new.format(command.arguments_description,command.,command.arguments).strip if command.commands.empty? synopses << one_line_usage else synopses = sorted_synopses(command) if command.has_action? synopses.unshift(one_line_usage) end end synopses end |