class KXI::CLI::ExplicitArgument

Represents argument specified explicitly with name

Public Class Methods

new(nm, desc, sh = nil, req = false) click to toggle source

Instantiates the {KXI::CLI::ExplicitArgument} class @param nm [String] Name of argument @param desc [String] Description of argument @param sh [String, nil] Shortcut of argument @param req [Bool] Specifies whether argument is mandatory

Calls superclass method KXI::CLI::Argument::new
# 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

Public Instance Methods

headline() click to toggle source

Gets full descriptive name of argument @return [String] Full name of argument

# File lib/kxi/cli/explicit_argument.rb, line 9
def headline
        ret = ''
        ret = "-#{@sh}, " if @sh != nil
        ret += "--#{name}"
        return ret
end
shortcut() click to toggle source

Gets the shortcut symbol of argument @return [String] Shortcut symbol of argument

# File lib/kxi/cli/explicit_argument.rb, line 24
def shortcut
        @sh
end
syntax() click to toggle source

Gets syntax of argument @return [String] Syntax of argument

# File lib/kxi/cli/explicit_argument.rb, line 18
def syntax
        headline
end