class KXI::CLI::Argument
Represents argument of command-line interface
Public Class Methods
new(nm, desc, req, order)
click to toggle source
Instantiates the {KXI::CLI::Argument} class @param nm [String] Name of argument @param desc [String] Description of argument @param req [Bool] Determines whether argument is mandatory @param order [Number] Order of argument
# File lib/kxi/cli/argument.rb, line 48 def initialize(nm, desc, req, order) raise(Exception.new('Invalid argument name!')) unless /^[A-Za-z0-9\-]+$/m =~ nm @name = nm.downcase @desc = desc @req = req @order = order end
Public Instance Methods
description()
click to toggle source
Gets the description of argument @return [String] Description of argument
# File lib/kxi/cli/argument.rb, line 27 def description @desc end
headline()
click to toggle source
Gets full descriptive name of argument @return [String] Full name of argument
# File lib/kxi/cli/argument.rb, line 21 def headline name end
name()
click to toggle source
Gets the name of argument @return [String] Name of argument
# File lib/kxi/cli/argument.rb, line 9 def name @name end
order()
click to toggle source
Gets the order of argument (in descending order) @return [Number] Order of argument
# File lib/kxi/cli/argument.rb, line 39 def order @order end
required?()
click to toggle source
Indicates whether argument is mandatory @return [Bool] True if argument is mandatory; otherwise false
# File lib/kxi/cli/argument.rb, line 33 def required? @req end
syntax()
click to toggle source
Gets syntax of argument @return [String] Syntax of argument
# File lib/kxi/cli/argument.rb, line 15 def syntax name end