class

Optimist::Option

Inherits Reference < Object

Abstract base class for all other Options.

Constructors

new(name : String, desc : String, default : T, long : LongNameType = nil, alt : AlternatesType = nil, short : ShortNameType = nil, permitted : PermittedType = nil, callback : Option -> Nil | Nil = nil, permitted_response : String = "option '%{arg}' only accepts %{valid_string}", required : Bool = false, hidden : Bool = false, multi : Bool | Nil = nil) forall T
Source

Class methods

create(name : String, desc : String, cls : Class | Nil = nil, default : _ = nil, **kwargs)

Factory class method Determines which type of object to create based on arguments passed to Optimist.opt. This is tricky because we allow the default to be able to set the option's type.

Source

Instance methods

add_argument_value(a : Array(String), b : Bool)
Source
default
Source
desc
Source
description_with_default(str)

Format the educate-line description including the default-value(s)

Source
description_with_permitted(str)

Format the educate-line description including the permitted-value(s)

Source
disallow_multiple_args(paramlist : Array(String))
Source
doesnt_need_autogen_short

TODO: push into SHORT

Source
educate
Source
format_stdio(obj)

Format stdio like objects to a string

Source
full_description

Format the educate-line description including the default and permitted value(s)

Source
given?
Source
long
Source
max_args
Source
min_args
Source
name
Source
needs_an_argument
Source
permitted
Source
permitted_response
Source
permitted_type_valid?
Source
permitted_value?(val : DefaultType) : Bool

Incoming values from the command-line should be strings, so we should stringify any permitted types as the basis of comparison.

Source
required?
Source
short
Source
takes_an_argument
Source
takes_multiple
Source
trigger_callback
Source
type_format

Provide type-format string. Default to empty, but should probably be overridden for most subclasses.

Source
validate_permitted(arg : String, value : DefaultType) : Void
Source
value
Source