Class: Optitron::Dsl::RootParserDsl
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from AbstractDsl
#arg, #configure_with, #opt
Constructor Details
Returns a new instance of RootParserDsl.
80
81
82
83
|
# File 'lib/optitron/dsl.rb', line 80
def initialize(parser)
@target = parser
@unclaimed_opts = []
end
|
Instance Attribute Details
#unclaimed_opts ⇒ Object
Returns the value of attribute unclaimed_opts.
79
80
81
|
# File 'lib/optitron/dsl.rb', line 79
def unclaimed_opts
@unclaimed_opts
end
|
Instance Method Details
#cmd(name, description = nil, opts = nil, &blk) ⇒ Object
100
101
102
103
104
|
# File 'lib/optitron/dsl.rb', line 100
def cmd(name, description = nil, opts = nil, &blk)
command_option = Option::Cmd.new(name, description, opts)
CmdParserDsl.new(self, command_option).configure_with(&blk) if blk
@target.commands << [name, command_option]
end
|
#help(desc = "Print help message") ⇒ Object
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/optitron/dsl.rb', line 85
def help(desc = "Print help message")
configure_with {
opt 'help', desc, :short_name => '?', :suppress_no => true, :run => proc{ |value, response|
if value
puts @target.help
exit(0)
end
}
}
end
|
#short_opts ⇒ Object
96
97
98
|
# File 'lib/optitron/dsl.rb', line 96
def short_opts
@target.short_opts
end
|