Class: Vnehm::HelpCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/vnehm/commands/help_command.rb

Constant Summary collapse

SPACES_BTWN_NAME_AND_DESC =
15

Instance Attribute Summary

Attributes inherited from Command

#options, #options_descs

Instance Method Summary collapse

Methods inherited from Command

#add_option, #handle_options, #initialize, #invoke

Constructor Details

This class inherits a constructor from Vnehm::Command

Instance Method Details

#argumentsObject



21
22
23
# File 'lib/vnehm/commands/help_command.rb', line 21

def arguments
  { 'КОМАНДА' => 'имя команды (может быть сокращено), справку которой нужно показать' }
end

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/vnehm/commands/help_command.rb', line 6

def execute
  command_name = options[:args].pop
  if command_name.nil?
    UI.say HELP
    UI.term
  end

  @cmd = CommandManager.find_command(command_name)

  show_usage
  show_summary
  show_arguments unless @cmd.arguments.empty?
  show_options unless @cmd.options.empty?
end

#program_nameObject



25
26
27
# File 'lib/vnehm/commands/help_command.rb', line 25

def program_name
  'vnehm help'
end

#summaryObject



29
30
31
# File 'lib/vnehm/commands/help_command.rb', line 29

def summary
  'Показ справки для определенной команды'
end

#usageObject



33
34
35
# File 'lib/vnehm/commands/help_command.rb', line 33

def usage
  "#{program_name} КОМАНДА"
end