Version 1.6: Formatting help
Added a new formatting system #109. You can now set the formatter on Apps. This has also simplified the internals of Apps and Options a bit by separating most formatting code.
- Added
CLI::Formatter
andformatter
slot for apps, inherited. FormatterBase
is the minimum required.FormatterLambda
provides for the easy addition of an arbitrary function.- Added
help_all
support (not added by default).
Changes to the help system (most normal users will not notice this):
- Renamed
single_name
toget_name(false, false)
(the default). - The old
get_name()
is nowget_name(false, true)
. - The old
get_pname()
is nowget_name(true, false)
. - Removed
help_*
functions. - Protected function
_has_help_positional
removed. format_help
can now be chained.- Added getters for the missing parts of options (help no longer uses any private parts).
- Help flags now use new
short_circuit
property to simplify parsing. #121
New for Config file reading and writing #121:
- Overridable, bidirectional Config.
- ConfigINI provided and used by default.
- Renamed ini to config in many places.
- Has
config_formatter()
andget_config_formatter()
. - Dropped prefix argument from
config_to_str
. - Added
ConfigItem
. - Added an example of a custom config format using nlohmann/json. #138
Validators are now much more powerful #118, all built in validators upgraded to the new form:
- A subclass of
CLI::Validator
is now also accepted. - They now can set the type name to things like
PATH
andINT in [1-4]
. - Validators can be combined with
&
and|
. - Old form simple validators are still accepted.
Other changes:
- Fixing
parse(args)
'sargs
setting and ordering after parse. #141 - Replaced
set_custom_option
withtype_name
andtype_size
instead ofset_custom_option
. Methods returnthis
. [#136] - Dropped
set_
on Option'stype_name
,default_str
, anddefault_val
. [#136] - Removed
set_
from App'sfailure_message
,footer
,callback
, andname
. [#136] - Fixed support
N<-1
fortype_size
. #140 - Added
->each()
to make adding custom callbacks easier. #126 - Allow empty options
add_option("-n",{})
to be edited later witheach
#142 - Added filter argument to
get_subcommands
,get_options
; use empty filter{}
to avoid filtering. - Added
get_groups()
to get groups. - Better support for manual options with
get_option
,set_results
, andempty
. #119 lname
andsname
have getters, addedconst get_parent
. #120- Using
add_set
will now capture L-values for sets, allowing further modification. #113 - Dropped duplicate way to run
get_type_name
(get_typeval
). - Removed
requires
in favor ofneeds
(deprecated in last version). #112 - Const added to argv. #126
Backend and testing changes: