Class: EacCli::Runner::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_cli/runner/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDefinition

Returns a new instance of Definition.



15
16
17
18
# File 'lib/eac_cli/runner/definition.rb', line 15

def initialize
  self.description = '-- NO DESCRIPTION SET --'
  self.options_argument = true
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



12
13
14
# File 'lib/eac_cli/runner/definition.rb', line 12

def description
  @description
end

#options_argumentObject

Returns the value of attribute options_argument.



13
14
15
# File 'lib/eac_cli/runner/definition.rb', line 13

def options_argument
  @options_argument
end

Instance Method Details

#alt(&block) ⇒ Object



20
21
22
23
24
25
# File 'lib/eac_cli/runner/definition.rb', line 20

def alt(&block)
  r = ::EacCli::Runner::Definition.new
  r.instance_eval(&block)
  alternatives << r
  r
end

#alternativesObject



27
28
29
# File 'lib/eac_cli/runner/definition.rb', line 27

def alternatives
  @alternatives ||= []
end

#arg_opt(short, long, description, option_options = {}) ⇒ Object



31
32
33
# File 'lib/eac_cli/runner/definition.rb', line 31

def arg_opt(short, long, description, option_options = {})
  options << ArgumentOption.new(short, long, description, option_options)
end

#bool_opt(short, long, description, option_options = {}) ⇒ Object



35
36
37
# File 'lib/eac_cli/runner/definition.rb', line 35

def bool_opt(short, long, description, option_options = {})
  options << BooleanOption.new(short, long, description, option_options)
end

#desc(description) ⇒ Object



39
40
41
# File 'lib/eac_cli/runner/definition.rb', line 39

def desc(description)
  self.description = description
end

#optionsObject



47
48
49
# File 'lib/eac_cli/runner/definition.rb', line 47

def options
  @options ||= []
end

#options_arg(options_argument) ⇒ Object



43
44
45
# File 'lib/eac_cli/runner/definition.rb', line 43

def options_arg(options_argument)
  self.options_argument = options_argument
end

#pos_arg(name, arg_options = {}) ⇒ Object



51
52
53
# File 'lib/eac_cli/runner/definition.rb', line 51

def pos_arg(name, arg_options = {})
  positional << PositionalArgument.new(name, arg_options)
end

#positionalObject



55
56
57
# File 'lib/eac_cli/runner/definition.rb', line 55

def positional
  @positional ||= []
end