GuillotineModels.Utilities.Args
GuillotineModels.Utilities.Args
— ModuleSubmodule of Utilities that groups the utilities related to command-line parsing.
GuillotineModels.Utilities.Args.Arg
— TypeAn argument with name
, default
value, and help
message.
name::String
The name with no initial double dashes but with dashes instead of spaces.
default::Any
The default value if the argument is not specified. Use
false
for flags.help::String
The help message to be displayed about this argument.
ArgParse.add_arg_table!
— MethodArgParse.add_arg_table!(settings :: ArgParseSettings, arg :: Arg)
A specialization of ArgParse.add_arg_table!
to transform Arg
objects into options of ArgParseSettings
. Boolean arguments become :store_{true|false}
options (depending on the default) and non-boolean arguments become :store_arg
options with a default (and enforcing the same arg_type of the default).
GuillotineModels.Utilities.Args.accepted_arg_list
— Methodaccepted_arg_list(::Val{T}) :: Vector{Arg} where {T}
Generic error fallback. Any model or solver to be supported by GuillotineModules.SolversArgs.run
should implement their own version of this method (replacing the T
in ::Val{T}
by a Symbol identifying the solver package or the name of the model). Look at module SolversArgs source for examples of the implementation for a solver, and at PPG2KP module source for examples for a model.
Gives the list of accepted options by some model or solver. The options have either a boolean default (in this case they take no argument, the presence of the option just flips the default value) or a non-boolean default (in this case, if they are passed in the command-line, they must have a parameter; if they are not passed, the default value is used). Every solver implementation must support the no-output
and preferably the raw-argument
option too. The name of the supported solvers and implemented methods need to be passed to the run
method for them to be considered by it.
GuillotineModels.Utilities.Args.create_normalized_arg_subset
— Methodcreate_normalized_arg_subset(p_args, selected :: Vector{Arg})
Create a new Dict
with keys equal to selected
names and values equal to selected
defaults, except that if p_args
has a key with the same name as an argument then the value in p_args
is used instead the default.
It shows an warning for every key in p_args
that is not a name in selected
.
If a quiet
flag is recognized by selected and is true (either by explicit definition or by default), then the warnings are not printed.
GuillotineModels.Utilities.Args.throw_if_incompatible_options
— Methodthrow_if_incompatible_options(::Val{T}, p_args) where {T}
Generic error fallback. Any model or solver to be supported by GuillotineModels.SolversArgs.run
should implement their own version of this method (replacing the T
in ::Val{T}
by a Symbol identifying the solver package or the name of the model). Look at module SolversArgs source for examples of the implementation for a solver, and at PPG2KP module source for examples for a model. Every solver implementation must support the no-output
option, and there is no need to guarantee that conflicts with involving the raw-argument
option are detected.
Often is specialized to an empty method, as is not so often that solvers or models have conflicting options.