diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2021-06-04 20:46:05 +0200 |
---|---|---|
committer | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2021-06-04 22:10:42 +0200 |
commit | 18b3cfd857fc9e29a88023654c66a469ca1352da (patch) | |
tree | 673802a1fa5f0c2b54120251cf22ce48837270be | |
parent | 65548f678899d0f2882de8f7cf810ab782c3cf8e (diff) | |
download | genimage-18b3cfd857fc9e29a88023654c66a469ca1352da.tar.gz genimage-18b3cfd857fc9e29a88023654c66a469ca1352da.tar.xz |
config.c: allow hiding specific command line options from --help
Since --includepath will be conditionally supported, add a flag to
struct config so we can suppress it from --help if genimage was built
against an old libconfuse. We will still accept the option and then
display an error message better than "invalid option --includepath",
but there's no reason to advertise it in --help.
This also makes writing a test case a little easier - or rather, the
condition for when to skip the test.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
-rw-r--r-- | config.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -33,6 +33,7 @@ struct config { struct list_head list; char *value; char *def; + int hidden; }; static void show_help(const char *cmd) @@ -47,6 +48,8 @@ static void show_help(const char *cmd) " -v, --version\n", cmd); list_for_each_entry(c, &optlist, list) { char opt[20], def[20]; + if (c->hidden) + continue; snprintf(opt, 20, "%s <arg>", c->name); snprintf(def, 20, "[ %s ]", c->def); printf(" --%-20s %-20s (%s)\n", opt, c->def ? def : "", c->env); |