class Cling::Option
- Cling::Option
- Reference
- Object
Overview
Represents a command line flag option, supporting boolean and string values. Options are parsed
after the main command taking priority over the argument resolution (see Executor#handle
).
Defined in:
cling/option.crConstructors
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. - #default : Value::Type
- #default=(default : Value::Type)
- #description : String | Nil
- #description=(description : String | Nil)
-
#has_default? : Bool
Returns
true
if a default value is set. -
#is?(name : String) : Bool
Returns true if the name matches the option's long or short flag name.
- #long : String
- #long=(long : String)
- #required=(required : Bool)
- #required? : Bool
- #short : Char | Nil
- #short=(short : Char | Nil)
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
- #type : Type
- #type=(type : Type)
- #value : Value | Nil
- #value=(value : Value | Nil)
Constructor Detail
def self.new(long : String, short : Char | Nil = nil, description : String | Nil = nil, required : Bool = false, type : Type = :none, default : Value::Type = nil)
#
Instance Method Detail
def ==(other : self)
#
Description copied from class Reference
Returns true
if this reference is the same as other. Invokes same?
.
def is?(name : String) : Bool
#
Returns true if the name matches the option's long or short flag name.
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>