class Cling::Argument
- Cling::Argument
- Reference
- Object
Overview
Represents a command line argument, this can be a single value or a string value. Arguments are
parsed after the main command and any subcommands are resolved. Note that Option
s that have
values take priority in the resolution list, so the following example would only yield 2
arguments:
./greet --time=day Dev
# ^^^
# belongs to the flag option
Arguments should typically be defined in the Command#setup
method of a command using
Command#add_argument
to prevent conflicts.
Defined in:
cling/argument.crConstructors
Instance Method Summary
- #description : String | Nil
- #description=(description : String | Nil)
- #multiple=(multiple : Bool)
- #multiple? : Bool
- #name : String
- #name=(name : String)
- #required=(required : Bool)
- #required? : Bool
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
- #value : Value | Nil
- #value=(value : Value | Nil)
Constructor Detail
def self.new(name : String, description : String | Nil = nil, required : Bool = false, multiple : Bool = false)
#
Instance Method Detail
def to_s(io : IO) : Nil
#
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>