Method: CLAide::Argument#initialize

Defined in:
lib/claide/argument.rb

#initialize(names, required, repeatable = false) ⇒ Argument

Returns a new instance of Argument.

Examples:


# A required parameter that can be either a NAME or URL
Argument.new(%(NAME URL), true)

Parameters:

  • names (String, Array<String>)

    List of the names of each parameter alternatives. For convenience, if there is only one alternative for that parameter, we can use a String instead of a 1-item Array

  • required (Boolean)

    true if the parameter is required, false if it is optional

  • repeatable (Boolean) (defaults to: false)

    If true, the argument can appear multiple times in the command. In that case, an ellipsis will be appended after the argument in the help banner.



47
48
49
50
51
# File 'lib/claide/argument.rb', line 47

def initialize(names, required, repeatable = false)
  @names = Array(names)
  @required = required
  @repeatable = repeatable
end