Class: Pik::Help

Inherits:
Command show all
Defined in:
lib/pik/commands/help_command.rb

Instance Attribute Summary

Attributes inherited from Command

#config, #debug, #options, #output, #version

Instance Method Summary collapse

Methods inherited from Command

#actual_gem_home, #add_sigint_handler, aka, choose_from, #close, cmd_name, #cmd_name, #create, #current_gem_bin_path, #current_version?, #default_gem_home, #delete_old_pik_script, description, #editors, #find_config_from_path, #gem_path, #get_version, hl, inherited, #initialize, it, names, #parse_options, #pik_version, #sh, summary

Constructor Details

This class inherits a constructor from Pik::Command

Instance Method Details

#command_optionsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/pik/commands/help_command.rb', line 26

def command_options
  options.program_name = "pik command"
  sep = <<SEP

To get help with a command

  pik help (command)

To list all commands and descriptions:

  pik help commands

SEP
  options.separator sep
end

#executeObject



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

def execute
  puts options if @args.empty? && !version
  
  @args.each do |a|
    @msg = case a.to_sym
    when *Commands.list
      Commands.find(a).description
    when :commands
      Commands.description
    else
      "There is no command '#{a}' \n" +
      Pik::Help.description
    end
    
    puts "\n" + @msg + "\n"
  end

end