Class: Travis::CLI::Help

Inherits:
Command show all
Defined in:
lib/travis/cli/help.rb

Instance Attribute Summary

Attributes inherited from Command

#arguments, #config, #force_interactive, #formatter, #input, #output

Instance Method Summary collapse

Methods inherited from Command

abstract, abstract?, command_name, #command_name, #debug, #execute, #help, #initialize, #parse, #say, #setup, skip, #terminal, #usage, #write_to

Methods included from Parser

#new, #on, #on_initialize

Constructor Details

This class inherits a constructor from Travis::CLI::Command

Instance Method Details

#commandsObject


16
17
18
# File 'lib/travis/cli/help.rb', line 16

def commands
  CLI.commands.sort_by { |c| c.command_name }
end

#run(command = nil) ⇒ Object


6
7
8
9
10
11
12
13
14
# File 'lib/travis/cli/help.rb', line 6

def run(command = nil)
  if command
    say CLI.command(command).new.help
  else
    say "Usage: #$0 COMMAND ...\n\nAvailable commands:\n\n"
    commands.each { |c| say "\t#{c.command_name}" }
    say "\nrun `#$0 help COMMAND` for more infos"
  end
end