Class: Brut::CLI::Commands::Help

Inherits:
BaseCommand show all
Defined in:
lib/brut/cli/commands/help.rb

Instance Attribute Summary collapse

Attributes inherited from BaseCommand

#parent_command

Instance Method Summary collapse

Methods inherited from BaseCommand

#accepts, #args_description, #argv, #default_command, #default_command_class, #env, #env_vars, #execute, #name, #options, #opts, #puts, #stderr, #stdin, #stdout, #system!

Constructor Details

#initialize(command, option_parser) ⇒ Help

Returns a new instance of Help.



5
6
7
8
# File 'lib/brut/cli/commands/help.rb', line 5

def initialize(command,option_parser)
  @command = command
  @option_parser = option_parser
end

Instance Attribute Details

#option_parserObject

Returns the value of attribute option_parser.



3
4
5
# File 'lib/brut/cli/commands/help.rb', line 3

def option_parser
  @option_parser
end

Instance Method Details

#bootstrap?Boolean

Returns:

  • (Boolean)


24
# File 'lib/brut/cli/commands/help.rb', line 24

def bootstrap? = false

#commandsObject



10
# File 'lib/brut/cli/commands/help.rb', line 10

def commands = []

#default_rack_envObject



25
# File 'lib/brut/cli/commands/help.rb', line 25

def default_rack_env = nil

#descriptionObject



2
# File 'lib/brut/cli/commands/help.rb', line 2

def description = "Get help for the app or a command"

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/brut/cli/commands/help.rb', line 12

def run
  stdout.puts_no_prefix @option_parser.to_s
  if @command.commands.any?
    stdout.puts_no_prefix
    stdout.puts_no_prefix "COMMANDS"
    stdout.puts_no_prefix
    @command.commands.each do |command|
      stdout.puts_no_prefix "  #{command.name} - #{command.description}"
    end
  end
  0
end