Class: CTioga2::Commands::CommandArgument

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/commands/arguments.rb

Overview

TODO:

There should be real options mangling capacities, with:

An argument to a Command

  • (possibly deprecated) aliases for options

  • _ to - mangling

  • other things ?

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name = nil, desc = nil) ⇒ CommandArgument

type is a named CommandType



50
51
52
53
54
55
56
57
# File 'lib/ctioga2/commands/arguments.rb', line 50

def initialize(type, name = nil, desc = nil)
  @type = CommandType.get_type(type)
  @name = name
  @description = desc

  @option_target = nil
  @option_deprecated = false
end

Instance Attribute Details

#descriptionObject

A small description of the argument



37
38
39
# File 'lib/ctioga2/commands/arguments.rb', line 37

def description
  @description
end

#nameObject

The name of the argument. Uniquely for display in the help documentation.



34
35
36
# File 'lib/ctioga2/commands/arguments.rb', line 34

def name
  @name
end

#option_deprecatedObject

Whether or not the option is deprecated.

If evaluates as true and different from true, is converted into a string used as an explanation to the user



47
48
49
# File 'lib/ctioga2/commands/arguments.rb', line 47

def option_deprecated
  @option_deprecated
end

#option_targetObject

The target for the option, in case it is different from its name



41
42
43
# File 'lib/ctioga2/commands/arguments.rb', line 41

def option_target
  @option_target
end

#typeObject

The type of the argument, a CommandType object.



30
31
32
# File 'lib/ctioga2/commands/arguments.rb', line 30

def type
  @type
end

Instance Method Details

#displayed_nameObject

Returns a name suitable for display in a documentation, such as the command-line help.



61
62
63
64
65
66
67
# File 'lib/ctioga2/commands/arguments.rb', line 61

def displayed_name
  if @name
    return @name
  else
    return @type.name
  end
end