Class: Compass::Commands::Help

Inherits:
Base
  • Object
show all
Defined in:
lib/compass/commands/help.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #working_path

Attributes included from Actions

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #perform, register

Methods included from Actions

#basename, #compile, #copy, #directory, #process_erb, #relativize, #remove, #separate, #strip_trailing_separator, #write_file

Constructor Details

This class inherits a constructor from Compass::Commands::Base

Class Method Details

.description(command) ⇒ Object



65
66
67
# File 'lib/compass/commands/help.rb', line 65

def description(command)
  "Get help on a compass command or extension"
end

.option_parser(arguments) ⇒ Object



58
59
60
61
# File 'lib/compass/commands/help.rb', line 58

def option_parser(arguments)
  parser = Compass::Exec::CommandOptionParser.new(arguments)
  parser.extend(HelpOptionsParser)
end

.parse!(arguments) ⇒ Object



68
69
70
71
72
73
# File 'lib/compass/commands/help.rb', line 68

def parse!(arguments)
  parser = option_parser(arguments)
  parser.parse!
  parser.options[:help_command] = arguments.shift || 'help'
  parser.options
end

.usageObject



62
63
64
# File 'lib/compass/commands/help.rb', line 62

def usage
  option_parser([]).to_s
end

Instance Method Details

#executeObject



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/compass/commands/help.rb', line 76

def execute
  if Compass::Commands.command_exists? options[:help_command]
    $command = options[:help_command]
    puts Compass::Commands[options[:help_command]].usage
    $command = "help"
  elsif Compass::Frameworks.template_exists? options[:help_command]
    puts Compass::Frameworks.template_usage(options[:help_command])
  else
    raise OptionParser::ParseError, "No such command: #{options[:help_command]}"
  end
end