Class: KXI::CLI::ExplicitArgument

Inherits:
Argument
  • Object
show all
Defined in:
lib/kxi/cli/explicit_argument.rb

Overview

Represents argument specified explicitly with name

Direct Known Subclasses

FlagArgument, NamedArgument

Instance Method Summary collapse

Methods inherited from Argument

#description, #name, #order, #required?

Constructor Details

#initialize(nm, desc, sh = nil, req = false) ⇒ ExplicitArgument

Instantiates the KXI::CLI::ExplicitArgument class



33
34
35
36
# File 'lib/kxi/cli/explicit_argument.rb', line 33

def initialize(nm, desc, sh = nil, req = false)
  super(nm, desc, req, req ? 2 : 1)
  @sh = sh
end

Instance Method Details

#headlineString

Gets full descriptive name of argument



9
10
11
12
13
14
# File 'lib/kxi/cli/explicit_argument.rb', line 9

def headline
  ret = ''
  ret = "-#{@sh}, " if @sh != nil
  ret += "--#{name}"
  return ret
end

#shortcutString

Gets the shortcut symbol of argument



24
25
26
# File 'lib/kxi/cli/explicit_argument.rb', line 24

def shortcut
  @sh
end

#syntaxString

Gets syntax of argument



18
19
20
# File 'lib/kxi/cli/explicit_argument.rb', line 18

def syntax
  headline
end