Sha256: b9bcccf554fe6ce9c5cc82c5840539bf41009b343baff4a4f91b1033a1831e7a
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
module Compass module Commands module HelpOptionsParser def set_options(opts) banner = %Q{Usage: compass help [command] Description: The Compass Stylesheet Authoring Framework helps you build and maintain your stylesheets and makes it easy for you to use stylesheet libraries provided by others. To get help on a particular command please specify the command. Available commands: } Compass::Commands.all.sort_by{|c| c.to_s}.each do |command| banner << " * #{command}" if Compass::Commands[command].respond_to? :description banner << "\t- #{Compass::Commands[command].description(command)}" end banner << "\n" end opts.banner = banner super end end class Help < Base register :help class << self def option_parser(arguments) parser = Compass::Exec::CommandOptionParser.new(arguments) parser.extend(HelpOptionsParser) end def usage option_parser([]).to_s end def description(command) "Get help on a compass command or extension" end def parse!(arguments) parser = option_parser(arguments) parser.parse! parser.options[:help_command] = arguments.shift || 'help' parser.options end end def execute if Compass::Commands.command_exists? options[:help_command] $command = options[:help_command] puts Compass::Commands[options[:help_command]].usage $command = "help" else raise OptionParser::ParseError, "No such command: #{options[:help_command]}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
compass-edge-0.9.2 | lib/compass/commands/help.rb |
compass-edge-0.9.1 | lib/compass/commands/help.rb |
compass-edge-0.10.0.pre | lib/compass/commands/help.rb |