Class: Basketcase::HelpCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/basketcase/help_command.rb

Instance Attribute Summary

Attributes inherited from Command

#comment, #listener, #targets

Instance Method Summary collapse

Methods inherited from Command

#accept_args, #effective_targets, #initialize, #option_comment, #option_graphical, #option_recurse, #report, #specified_targets

Methods included from Utils

#mkpath

Constructor Details

This class inherits a constructor from Basketcase::Command

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/basketcase/help_command.rb', line 13

def execute
  if @targets.empty?
    puts @basketcase.usage
    exit
  end
  @targets.each do |command_name|
    command = make_command(command_name)
    puts
    puts "% basketcase #{command_name} #{command.synopsis}"
    puts
    puts command.help.gsub(/^/, "    ")
  end
end

#helpObject



9
10
11
# File 'lib/basketcase/help_command.rb', line 9

def help
  "Display usage instructions."
end

#synopsisObject



5
6
7
# File 'lib/basketcase/help_command.rb', line 5

def synopsis
  "[<command>]"
end