class

Cling::Option

Inherits Reference < Object

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).

Constructors

new(long : String, short : Char | Nil = nil, description : String | Nil = nil, required : Bool = false, hidden : Bool = false, type : Type = :none, default : Value::Type = nil)
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

Source
default
Source
default=(default : Value::Type)
Source
description
Source
description=(description : String | Nil)
Source
has_default?

Returns true if a default value is set.

Source
hidden=(hidden : Bool)
Source
hidden?
Source
is?(name : String) : Bool

Returns true if the name matches the option's long or short flag name.

Source
long
Source
long=(long : String)
Source
required=(required : Bool)
Source
required?
Source
short
Source
short=(short : Char | Nil)
Source
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>
Source
type
Source
type=(type : Type)
Source
value
Source
value=(value : Value | Nil)
Source

Nested types