Class: Wavesync::Commands::Help

Inherits:
Command
  • Object
show all
Defined in:
lib/wavesync/commands/help.rb

Constant Summary collapse

DESCRIPTION_COLUMN =
23

Instance Method Summary collapse

Methods inherited from Command

#parse_options

Instance Method Details

#runObject

: () -> void



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wavesync/commands/help.rb', line 16

def run
  subcommand_name = ARGV.shift

  if subcommand_name
    command = ALL.find { |cmd| subcommand_name == cmd.name }
    if command
      show_command_help(command)
    else
      puts "Unknown command: #{subcommand_name}"
      puts "Available commands: #{ALL.map(&:name).reject { |cmd_name| cmd_name == self.class.name }.join(', ')}"
      exit 1
    end
  else
    show_general_help
  end
end