From 4f6307f106f5e9dbf2937c4a2e5efa10bb8b19ad Mon Sep 17 00:00:00 2001 From: Yaroslav de la Peña Smirnov Date: Wed, 25 Feb 2026 16:26:34 +0300 Subject: cli: fix misplaced global opts in help --- cli/cli.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cli') diff --git a/cli/cli.h b/cli/cli.h index 1116595..05f8c6f 100644 --- a/cli/cli.h +++ b/cli/cli.h @@ -103,7 +103,7 @@ int cli_opt_long_set(struct cli_opt *self, const char *val) { struct cli_opt_long *opt = container_of(self, struct cli_opt_long, opt); - errno = 0; + errno = 0; char *endptr; opt->value = strtol(val, &endptr, 0); if (errno != 0 || *endptr != '\0') @@ -133,7 +133,7 @@ int cli_opt_ulong_set(struct cli_opt *self, const char *val) { struct cli_opt_ulong *opt = container_of(self, struct cli_opt_ulong, opt); - errno = 0; + errno = 0; char *endptr; opt->value = strtoul(val, &endptr, 0); if (errno != 0 || *endptr != '\0') @@ -267,8 +267,8 @@ static void explain_program(const struct cli *const cli) printf("%s\n", cli->header); printf("Usage: %s%s [command options]\n\n", - cli->opts ? "[global options] " : "", - cli->binary); + cli->binary, + cli->opts ? " [global options]" : ""); if (cli->cmds) { puts("Commands:"); @@ -298,8 +298,8 @@ static void explain_command(const struct cli *const cli, printf("%s\n", cli->header); printf("Usage: %s%s %s %s\n\n", - cli->opts ? "[global options] " : "", cli->binary, + cli->opts ? " [global options]" : "", cmd->name, cmd->usage ?: "[options]"); printf("%s\n\n", cmd->help); -- cgit v1.2.3