Class: ZergXcode::Plugins::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/zerg_xcode/plugins/help.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



2
3
4
5
6
7
8
9
10
# File 'lib/zerg_xcode/plugins/help.rb', line 2

def help
  {:short => 'command-line usage instructions',
   :long => <<"END" }
Usage: help [command]

Shows the usage for the given command. If no command is  given, shows a list of
commands with a short description for each command.
END
end

#run(args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/zerg_xcode/plugins/help.rb', line 12

def run(args)
  helpstr = "Xcode Project Modifier brought to you by Zergling.Net.\n"

  plugin = args.shift
  if ZergXcode::Plugins.all.include? plugin
    help = ZergXcode::Plugins.get(plugin).help
    helpstr << "#{plugin} - #{help[:short]}\n#{help[:long]}"
  else
    helpstr << "Available commands:\n"
    ZergXcode::Plugins.all.each do |plugin|
      short_help = ZergXcode::Plugins.get(plugin).help[:short]
      helpstr << "  #{plugin}: #{short_help}\n"
    end
  end
  
  print helpstr
  helpstr
end