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



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

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



39
40
41
# File 'lib/ctioga2/commands/arguments.rb', line 39

def description
  @description
end

#nameObject

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



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

def name
  @name
end

#option_deprecatedObject

Whether or not the option is deprecated



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

def option_deprecated
  @option_deprecated
end

#option_targetObject

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



43
44
45
# File 'lib/ctioga2/commands/arguments.rb', line 43

def option_target
  @option_target
end

#typeObject

The type of the argument, a CommandType object.



32
33
34
# File 'lib/ctioga2/commands/arguments.rb', line 32

def type
  @type
end

Instance Method Details

#displayed_nameObject

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



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

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