Class: Migr8::Actions::HelpAction

Inherits:
Action
  • Object
show all
Defined in:
lib/migr8.rb

Constant Summary collapse

NAME =
"help"
DESC =
"show help message of action, or list action names"
OPTS =
[]
ARGS =
'[action]'

Instance Method Summary collapse

Methods inherited from Action

#cmdopterr, find_by_name, #get_command, inherited, #parse, #parser, #repository, #short_usage, subclasses, #usage

Instance Method Details

#run(options, args) ⇒ Object



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
# File 'lib/migr8.rb', line 1455

def run(options, args)
  if args.length >= 2
    raise cmdopterr("help: too much argument")
  elsif args.length == 1
    action_name = args[0]
    action_class = Action.find_by_name(action_name)  or
      raise cmdopterr("#{action_name}: unknown action.")
    puts action_class.new.usage()
  else
    usage = Migr8::Application.new.usage()
    puts usage
  end
  nil
end