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:
Philip Top
2025-05-21 19:39:00 -07:00
committed by GitHub
parent 50591fb666
commit 5602f2b438
8 changed files with 330 additions and 10 deletions

View File

@@ -914,6 +914,11 @@ option_groups. These are:
is not allowed to have a single character short option starting with the same
character as a single dash long form name; for example, `-s` and `-single` are
not allowed in the same application.
- `.allow_subcommand_prefix_matching()`:🚧 If this modifier 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.
- `.fallthrough()`: Allow extra unmatched options and positionals to "fall
through" and be matched on a parent option. Subcommands by default are allowed
to "fall through" as in they will first attempt to match on the current