class MFXcode::Plugins::Help

Displays the help strings for other plugins.

Public Instance Methods

help() click to toggle source
# File lib/mfxcode/plugins/help.rb, line 23
  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) click to toggle source
# File lib/mfxcode/plugins/help.rb, line 33
def run(args)
  helpstr = "MFXcode brought to you by SopraSteria.\n"

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