This is an automated email from the ASF dual-hosted git repository.
dmeden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 8c0bcad135 ArgParser: Improve missing subcommand error message (#12646)
8c0bcad135 is described below
commit 8c0bcad135a7323005bf0fba1b84a35d5ce0ce9c
Author: Damian Meden <[email protected]>
AuthorDate: Tue Nov 11 10:50:51 2025 +0100
ArgParser: Improve missing subcommand error message (#12646)
Show attempted subcommand name in error message.
---
src/tscore/ArgParser.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/tscore/ArgParser.cc b/src/tscore/ArgParser.cc
index 8cc91fa524..00a4fd20b1 100644
--- a/src/tscore/ArgParser.cc
+++ b/src/tscore/ArgParser.cc
@@ -707,7 +707,13 @@ ArgParser::Command::parse(Arguments &ret, AP_StrVec &args)
}
// check for command required
if (!flag && _command_required) {
- help_message("No subcommand found for " + _name);
+ std::ostringstream msg;
+ if (!args.empty()) {
+ msg << "No sub-command '" << args[0] << "' found for " << _name;
+ } else {
+ msg << "No sub-command found for " << _name;
+ }
+ help_message(msg.str());
}
if (_name == parser_program_name) {
// if we are at the top level