abstract class Optimist::Option
- Optimist::Option
- Reference
- Object
Overview
Abstract base class for all other Options.
Direct Known Subclasses
- Optimist::BoolOpt
- Optimist::FileOpt
- Optimist::Float64ArrayOpt
- Optimist::Float64Opt
- Optimist::Int32ArrayOpt
- Optimist::Int32Opt
- Optimist::StringArrayOpt
- Optimist::StringFlagOpt
- Optimist::StringOpt
Defined in:
optimist/option.crConstructors
Class Method Summary
-
.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
.
Instance Method Summary
- #add_argument_value(a : Array(String), b : Bool)
- #default
- #desc : String
-
#description_with_default(str)
Format the educate-line description including the default-value(s)
-
#description_with_permitted(str)
Format the educate-line description including the permitted-value(s)
- #disallow_multiple_args(paramlist : Array(String))
-
#doesnt_need_autogen_short
TODO push into SHORT
- #educate
-
#format_stdio(obj)
Format stdio like objects to a string
-
#full_description
Format the educate-line description including the default and permitted value(s)
- #given? : Bool
- #long : Optimist::LongNames
- #max_args : Int32
- #min_args : Int32
- #name : String
- #needs_an_argument
- #permitted : Array(Int32) | Array(String) | Range(Int32, Int32) | Regex | Nil
- #permitted_response : String
- #permitted_type_valid?
-
#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.
- #required? : Bool
- #short : Optimist::ShortNames
- #takes_an_argument
- #takes_multiple
- #trigger_callback
-
#type_format
Provide type-format string.
- #validate_permitted(arg : String, value : DefaultType) : Void
- #value
Constructor Detail
Class Method Detail
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.
Instance Method Detail
Format the educate-line description including the default-value(s)
Format the educate-line description including the permitted-value(s)
Format the educate-line description including the default and permitted value(s)
Incoming values from the command-line should be strings, so we should stringify any permitted types as the basis of comparison.
Provide type-format string. Default to empty, but should probably be overridden for most subclasses.