From ffec523aa0a938beab7def1893d41685e28d2b34 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 31 Dec 2022 19:55:38 +0000 Subject: cli: Allow optional application description --- test/cli.c | 6 ++++++ test/cli.h | 1 + 2 files changed, 7 insertions(+) diff --git a/test/cli.c b/test/cli.c index 8f32228..b1b776f 100644 --- a/test/cli.c +++ b/test/cli.c @@ -742,6 +742,12 @@ void cli_help(const struct cli_table *cli, const char *prog_name) cli__count(cli, &count, &pcount, &max_len, &pmax_len, &phas_desc); + if (cli->d != NULL) { + fprintf(stderr, "\n"); + cli__print_wrapping_string(cli->d, 0); + fprintf(stderr, "\n"); + } + fprintf(stderr, "\nUsage: %s", prog_name); if (pcount > 0) { diff --git a/test/cli.h b/test/cli.h index d7493e4..ffcd272 100644 --- a/test/cli.h +++ b/test/cli.h @@ -73,6 +73,7 @@ struct cli_table { const struct cli_table_entry *entries; size_t count; size_t min_positional; + const char *d; /**< Description of this application for help output. */ }; /** -- cgit v1.2.1