Class: Webbynode::Commands::Help

Inherits:
Webbynode::Command show all
Defined in:
lib/webbynode/commands/help.rb

Constant Summary

Constants inherited from Webbynode::Command

Webbynode::Command::Aliases, Webbynode::Command::CommandError, Webbynode::Command::InvalidCommand, Webbynode::Command::InvalidOption, Webbynode::Command::Settings

Instance Method Summary collapse

Methods inherited from Webbynode::Command

add_alias, #api, class_for, command, command_class_name, description, for, #gemfile, #git, help, inherited, #initialize, #io, #no?, #notify, option, #option, #options, options_help, #param, #param_values, parameter, #params, #params_hash, params_help, #pushand, #remote_executor, requires_initialization!, requires_options!, requires_pushed_application!, #run, #server, setting, #settings, summary, summary_help, usage, #validate_initialization, #validate_options, #yes?

Constructor Details

This class inherits a constructor from Webbynode::Command

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/webbynode/commands/help.rb', line 6

def execute
  if param(:command) == "commands"
    puts "usage: #{"webbynode".color(:white).bright} #{"COMMAND".color(:green)}"
    puts
    puts "Available commands:"
    dir = File.join(File.expand_path(File.dirname(__FILE__)), "/*.rb")
    Dir[dir].each do |file|
      command = file.split("/").last
      command.gsub!(/\.rb/, "")
      
      puts "    #{command.ljust(15).color(:green)} #{Webbynode::Command.class_for(command).setting(:summary)}"
    end
    puts 
    puts "Try '#{"webbynode help".color(:white).bright} #{"COMMAND".color(:green)}' for more information."
  else
    kls = Help.for(param(:command))
    if kls
      puts kls.help
    end
  end
end