diff --git a/src/cli.c b/src/cli.c index 4e7ae1496..2b3ea3a3c 100644 --- a/src/cli.c +++ b/src/cli.c @@ -170,10 +170,17 @@ static char *cli_gen_usage_msg(struct appctx *appctx, char * const *args) chunk_reset(tmp); if (ishelp) // this is the help message. chunk_strcat(tmp, "The following commands are valid at this level:\n"); - else if (!length && (!args || !*args || !**args)) // no match - chunk_strcat(tmp, "Unknown command. Please enter one of the following commands only:\n"); - else // partial match - chunk_strcat(tmp, "Unknown command, but maybe one of the following ones is a better match:\n"); + else { + chunk_strcat(tmp, "Unknown command: '"); + if (args && *args) + chunk_strcat(tmp, *args); + chunk_strcat(tmp, "'"); + + if (!length && (!args || !*args || !**args)) // no match + chunk_strcat(tmp, ". Please enter one of the following commands only:\n"); + else // partial match + chunk_strcat(tmp, ", but maybe one of the following ones is a better match:\n"); + } for (idx = 0; idx < CLI_MAX_MATCHES; idx++) { matches[idx].kw = NULL;