Class: Twigg::Command::Help

Inherits:
Twigg::Command show all
Defined in:
lib/twigg/command/help.rb

Constant Summary collapse

PUBLIC_HELP_TOPICS =
PUBLIC_SUBCOMMANDS + %w[commands usage]
HELP_TOPICS =
PUBLIC_HELP_TOPICS + EASTER_EGGS

Constants inherited from Twigg::Command

EASTER_EGGS, PUBLIC_SUBCOMMANDS, SUBCOMMANDS

Instance Method Summary collapse

Methods inherited from Twigg::Command

run, #run!

Constructor Details

#initialize(*args) ⇒ Help

Returns a new instance of Help.



7
8
9
10
11
# File 'lib/twigg/command/help.rb', line 7

def initialize(*args)
  super
  @topic = @args.shift
  ignore @args
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
# File 'lib/twigg/command/help.rb', line 13

def run
  if HELP_TOPICS.include?(@topic)
    show_help(@topic)
  else
    PUBLIC_HELP_TOPICS.each { |topic| show_help(topic) }
  end
end