Subcommand plurality (#1169)

Partially address #1168 fix subcommand plurality when subcommand_max count is 0

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Philip Top
2025-06-05 17:48:01 -07:00
committed by GitHub
parent 542ef71d8d
commit 328ac68432
7 changed files with 26 additions and 10 deletions

View File

@@ -133,8 +133,7 @@ CLI11_INLINE std::string Formatter::make_usage(const App *app, std::string name)
[](const CLI::App *subc) { return ((!subc->get_disabled()) && (!subc->get_name().empty())); })
.empty()) {
out << ' ' << (app->get_require_subcommand_min() == 0 ? "[" : "")
<< get_label(app->get_require_subcommand_max() < 2 || app->get_require_subcommand_min() > 1 ? "SUBCOMMAND"
: "SUBCOMMANDS")
<< get_label(app->get_require_subcommand_max() == 1 ? "SUBCOMMAND" : "SUBCOMMANDS")
<< (app->get_require_subcommand_min() == 0 ? "]" : "");
}