Class: RatProto::Commands::Help

Inherits:
Base
  • Object
show all
Defined in:
lib/ratproto/cli.rb

Constant Summary

Constants inherited from Base

Base::DID_REGEXP, Base::HANDLE_REGEXP, Base::NSID_REGEXP

Instance Method Summary collapse

Instance Method Details

#executeObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ratproto/cli.rb', line 30

def execute
  program_name = File.basename($PROGRAM_NAME)

  if command
    command_class = RatProto::CLI.find_subcommand_class(command)
    signal_usage_error "unknown command: #{command}" unless command_class

    puts command_class.help("#{program_name} #{command}")
  else
    puts RatProto::CLI.help(program_name)
  end
end