opts :: OptionInt :: defaultinit
Init a new OptionInt with ahelp
message, a default
value and names
.
opts :: OptionParameter :: _parameter_mandatory
Is the parameter mandatory?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
opts :: Option :: default_value=
Default value of this optionopts :: OptionParameter :: defaultinit
opts :: OptionInt :: defaultinit
Init a new OptionInt with ahelp
message, a default
value and names
.
core :: Object :: defaultinit
opts :: Option :: defaultinit
Create a new optioncore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).opts :: OptionParameter :: parameter_mandatory
Is the parameter mandatory?opts :: OptionParameter :: parameter_mandatory=
Is the parameter mandatory?opts :: Option :: read_param
Consume parameters for this option
# An option with an Int as parameter
class OptionInt
super OptionParameter
redef type VALUE: Int
# Init a new OptionInt with a `help` message, a `default` value and `names`.
init(help: String, default: Int, names: String...) is old_style_init do
super(help, default, names)
end
redef fun convert(str)
do
if str.is_int then return str.to_i
errors.add "Expected an integer for option {names.join(", ")}."
return 0
end
end
lib/opts/opts.nit:229,1--246,3