mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 21:23:52 +00:00
Issue cleanup (#1059)
Fix docstring related to #1052 Fix config_to_string with defaults #1007 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
7be1740521
commit
b038a403ca
@ -1027,8 +1027,9 @@ functionality for tricky parsing situations.
|
|||||||
- Added `app.parse_order()` with original parse order
|
- Added `app.parse_order()` with original parse order
|
||||||
([#13](https://github.com/CLIUtils/CLI11/issues/13),
|
([#13](https://github.com/CLIUtils/CLI11/issues/13),
|
||||||
[#16](https://github.com/CLIUtils/CLI11/pull/16))
|
[#16](https://github.com/CLIUtils/CLI11/pull/16))
|
||||||
- Added `prefix_command()`, which is like `allow_extras` but instantly stops and
|
- Added `prefix_command()`, which is like `allow_extras` but ceases processing
|
||||||
returns. ([#8](https://github.com/CLIUtils/CLI11/issues/8),
|
and puts all remaining args in the remaining_args structure.
|
||||||
|
[#8](https://github.com/CLIUtils/CLI11/issues/8),
|
||||||
[#17](https://github.com/CLIUtils/CLI11/pull/17))
|
[#17](https://github.com/CLIUtils/CLI11/pull/17))
|
||||||
- Removed Windows warning ([#10](https://github.com/CLIUtils/CLI11/issues/10),
|
- Removed Windows warning ([#10](https://github.com/CLIUtils/CLI11/issues/10),
|
||||||
[#20](https://github.com/CLIUtils/CLI11/pull/20))
|
[#20](https://github.com/CLIUtils/CLI11/pull/20))
|
||||||
|
@ -1010,8 +1010,9 @@ option_groups. These are:
|
|||||||
- `.allow_extras()`: Do not throw an error if extra arguments are left over.
|
- `.allow_extras()`: Do not throw an error if extra arguments are left over.
|
||||||
- `.positionals_at_end()`: Specify that positional arguments occur as the last
|
- `.positionals_at_end()`: Specify that positional arguments occur as the last
|
||||||
arguments and throw an error if an unexpected positional is encountered.
|
arguments and throw an error if an unexpected positional is encountered.
|
||||||
- `.prefix_command()`: Like `allow_extras`, but stop immediately on the first
|
- `.prefix_command()`: Like `allow_extras`, but stop processing immediately on
|
||||||
unrecognized item. It is ideal for allowing your app or subcommand to be a
|
the first unrecognized item. All subsequent arguments are placed in the
|
||||||
|
remaining_arg list. It is ideal for allowing your app or subcommand to be a
|
||||||
"prefix" to calling another app.
|
"prefix" to calling another app.
|
||||||
- `.usage(message)`: 🆕 Replace text to appear at the start of the help string
|
- `.usage(message)`: 🆕 Replace text to appear at the start of the help string
|
||||||
after description.
|
after description.
|
||||||
|
@ -110,7 +110,7 @@ class App {
|
|||||||
/// if error error on an extra argument, and if capture feed it to the app
|
/// if error error on an extra argument, and if capture feed it to the app
|
||||||
config_extras_mode allow_config_extras_{config_extras_mode::ignore};
|
config_extras_mode allow_config_extras_{config_extras_mode::ignore};
|
||||||
|
|
||||||
/// If true, return immediately on an unrecognized option (implies allow_extras) INHERITABLE
|
/// If true, cease processing on an unrecognized option (implies allow_extras) INHERITABLE
|
||||||
bool prefix_command_{false};
|
bool prefix_command_{false};
|
||||||
|
|
||||||
/// If set to true the name was automatically generated from the command line vs a user set name
|
/// If set to true the name was automatically generated from the command line vs a user set name
|
||||||
@ -442,9 +442,10 @@ class App {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do not parse anything after the first unrecognized option and return
|
/// Do not parse anything after the first unrecognized option (if true) all remaining arguments are stored in
|
||||||
App *prefix_command(bool allow = true) {
|
/// remaining args
|
||||||
prefix_command_ = allow;
|
App *prefix_command(bool is_prefix = true) {
|
||||||
|
prefix_command_ = is_prefix;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description,
|
|||||||
std::string subname = subcom->get_name();
|
std::string subname = subcom->get_name();
|
||||||
clean_name_string(subname, keyChars);
|
clean_name_string(subname, keyChars);
|
||||||
|
|
||||||
if(subcom->get_configurable() && app->got_subcommand(subcom)) {
|
if(subcom->get_configurable() && (default_also || app->got_subcommand(subcom))) {
|
||||||
if(!prefix.empty() || app->get_parent() == nullptr) {
|
if(!prefix.empty() || app->get_parent() == nullptr) {
|
||||||
|
|
||||||
out << '[' << prefix << subname << "]\n";
|
out << '[' << prefix << subname << "]\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user