Class: EacCli::Definition
- Inherits:
-
Object
- Object
- EacCli::Definition
show all
- Defined in:
- lib/eac_cli/definition.rb,
lib/eac_cli/definition/base_option.rb,
lib/eac_cli/definition/boolean_option.rb,
lib/eac_cli/definition/argument_option.rb,
lib/eac_cli/definition/positional_argument.rb
Defined Under Namespace
Classes: ArgumentOption, BaseOption, BooleanOption, PositionalArgument
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Definition.
14
15
16
17
|
# File 'lib/eac_cli/definition.rb', line 14
def initialize
self.description = '-- NO DESCRIPTION SET --'
self.options_argument = true
end
|
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
11
12
13
|
# File 'lib/eac_cli/definition.rb', line 11
def description
@description
end
|
#options_argument ⇒ Object
Returns the value of attribute options_argument.
12
13
14
|
# File 'lib/eac_cli/definition.rb', line 12
def options_argument
@options_argument
end
|
Instance Method Details
#alt(&block) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/eac_cli/definition.rb', line 19
def alt(&block)
r = ::EacCli::Definition.new
r.instance_eval(&block)
alternatives << r
r
end
|
#alternatives ⇒ Object
26
27
28
|
# File 'lib/eac_cli/definition.rb', line 26
def alternatives
@alternatives ||= []
end
|
#arg_opt(short, long, description, option_options = {}) ⇒ Object
30
31
32
33
34
|
# File 'lib/eac_cli/definition.rb', line 30
def arg_opt(short, long, description, option_options = {})
options << ::EacCli::Definition::ArgumentOption.new(
short, long, description, option_options
)
end
|
#bool_opt(short, long, description, option_options = {}) ⇒ Object
36
37
38
|
# File 'lib/eac_cli/definition.rb', line 36
def bool_opt(short, long, description, option_options = {})
options << ::EacCli::Definition::BooleanOption.new(short, long, description, option_options)
end
|
#desc(description) ⇒ Object
40
41
42
|
# File 'lib/eac_cli/definition.rb', line 40
def desc(description)
self.description = description
end
|
#options ⇒ Object
48
49
50
|
# File 'lib/eac_cli/definition.rb', line 48
def options
@options ||= []
end
|
#options_arg(options_argument) ⇒ Object
44
45
46
|
# File 'lib/eac_cli/definition.rb', line 44
def options_arg(options_argument)
self.options_argument = options_argument
end
|
#options_first(enable = true) ⇒ Object
64
65
66
|
# File 'lib/eac_cli/definition.rb', line 64
def options_first(enable = true)
@options_first = enable
end
|
#options_first? ⇒ Boolean
68
69
70
|
# File 'lib/eac_cli/definition.rb', line 68
def options_first?
@options_first ? true : false
end
|
#pos_arg(name, arg_options = {}) ⇒ Object
#positional ⇒ Object
56
57
58
|
# File 'lib/eac_cli/definition.rb', line 56
def positional
@positional ||= []
end
|