Class: XPCOMCore::CommandParser
- Inherits:
-
Object
- Object
- XPCOMCore::CommandParser
show all
- Defined in:
- lib/xpcomcore-rubygem/commands.rb,
lib/xpcomcore-rubygem/commands/launch.rb,
lib/xpcomcore-rubygem/commands/generate.rb,
lib/xpcomcore-rubygem/commands/generate/library.rb,
lib/xpcomcore-rubygem/commands/generate/application.rb,
lib/xpcomcore-rubygem/commands/generate/template_helpers.rb,
lib/xpcomcore-rubygem/commands/generate/jeweler_builder_command.rb
Defined Under Namespace
Classes: GenerateCommand, LaunchCommand
Constant Summary
collapse
- @@commands =
[CmdParse::HelpCommand, CmdParse::VersionCommand]
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CommandParser.
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/xpcomcore-rubygem/commands.rb', line 14
def initialize
@cmd = CmdParse::CommandParser.new(true, true) @cmd.program_version = XPCOMCore::Version
@cmd.options = CmdParse::OptionParserWrapper.new do |opt|
opt.separator "Global options:"
opt.on("-q", "--quiet", "Be quiet about what's happening", self.class.method(:quiet=))
end
add_commands
end
|
Class Attribute Details
.quiet ⇒ Object
Returns the value of attribute quiet.
8
9
10
|
# File 'lib/xpcomcore-rubygem/commands.rb', line 8
def quiet
@quiet
end
|
Class Method Details
.add_command(cmd_class) ⇒ Object
36
37
38
|
# File 'lib/xpcomcore-rubygem/commands.rb', line 36
def self.add_command(cmd_class)
@@commands.push(cmd_class)
end
|
.load_commands ⇒ Object
29
30
31
32
33
34
|
# File 'lib/xpcomcore-rubygem/commands.rb', line 29
def self.load_commands
(XPCOMCore::GemRoot + "lib/xpcomcore-rubygem/commands").each_entry do |entry|
next unless entry.extname == ".rb"
require "xpcomcore-rubygem/commands/#{entry.basename}"
end
end
|
.log(msg) ⇒ Object
40
41
42
43
|
# File 'lib/xpcomcore-rubygem/commands.rb', line 40
def self.log(msg)
return nil if quiet
puts msg
end
|
Instance Method Details
#parse ⇒ Object
25
26
27
|
# File 'lib/xpcomcore-rubygem/commands.rb', line 25
def parse
@cmd.parse
end
|