mirror of
https://github.com/CLIUtils/CLI11.git
synced 2026-01-19 04:52:08 +00:00
add an example of finding close matches (#1152)
continue discussion on #1149 Adds subcommand prefix matching as a modifier to CLI. Adds an example of close matching logic for further exploration. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -105,6 +105,7 @@ at the point the subcommand is created:
|
||||
- Fallthrough
|
||||
- Group name
|
||||
- Max required subcommands
|
||||
- prefix_matching
|
||||
- validate positional arguments
|
||||
- validate optional arguments
|
||||
|
||||
@@ -156,6 +157,14 @@ ignored, even if they could match. Git is the traditional example for prefix
|
||||
commands; if you run git with an unknown subcommand, like "`git thing`", it then
|
||||
calls another command called "`git-thing`" with the remaining options intact.
|
||||
|
||||
### prefix matching
|
||||
|
||||
A modifier is available for subcommand matching,
|
||||
`->allow_subcommand_prefix_matching()`. if this is enabled unambiguious prefix
|
||||
portions of a subcommand will match. For Example `upgrade_package` would match
|
||||
on `upgrade_`, `upg`, `u` as long as no other subcommand would also match. It
|
||||
also disallows subcommand names that are full prefixes of another subcommand.
|
||||
|
||||
### Silent subcommands
|
||||
|
||||
Subcommands can be modified by using the `silent` option. This will prevent the
|
||||
|
||||
Reference in New Issue
Block a user