class WhirledPeas::Command::Help

Attributes

cmd[R]

Public Class Methods

description() click to toggle source
# File lib/whirled_peas/command/help.rb, line 6
def self.description
  'Show detailed help for a command'
end

Public Instance Methods

start() click to toggle source
# File lib/whirled_peas/command/help.rb, line 10
def start
  class_name = cmd.split('_').map(&:capitalize).join
  klass = Command.const_get(class_name)
  klass.print_usage
rescue NameError
  puts "Unrecognized command: #{cmd}"
  exit(1)
end

Private Instance Methods

options_usage() click to toggle source
# File lib/whirled_peas/command/help.rb, line 33
def options_usage
  [*super, '<command>'].join(' ')
end
validate!() click to toggle source
Calls superclass method WhirledPeas::Command::Base#validate!
# File lib/whirled_peas/command/help.rb, line 23
def validate!
  super
  cmd = args.shift
  if cmd.nil?
    @error_text = "#{command_name} requires a command"
  else
    @cmd = cmd
  end
end