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

#failed!, #initialize, #perform, register, #successful?

Methods included from Actions

#basename, #copy, #directory, #log_action, #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



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

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

.option_parser(arguments) ⇒ Object



53
54
55
56
57
# File 'lib/compass/commands/help.rb', line 53

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

.parse!(arguments) ⇒ Object



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

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

.usageObject



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

def usage
  option_parser([]).to_s
end

Instance Method Details

#executeObject



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/compass/commands/help.rb', line 72

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