diff --git a/src/shared/verbs.c b/src/shared/verbs.c index bf2d440bb0..47f219fab6 100644 --- a/src/shared/verbs.c +++ b/src/shared/verbs.c @@ -160,6 +160,9 @@ int _verbs_get_help_table(const Verb verbs[], const Verb verbs_end[], Table **re for (const Verb *verb = verbs; verb < verbs_end; verb++) { assert(verb->dispatch); + if (!verb->help) + continue; + /* We indent the option string by two spaces. We could set the minimum cell width and * right-align for a similar result, but that'd be more work. This is only used for * display. */ @@ -170,8 +173,7 @@ int _verbs_get_help_table(const Verb verbs[], const Verb verbs_end[], Table **re if (r < 0) return table_log_add_error(r); - const char *help = verb->help ?: "FIXME"; - _cleanup_strv_free_ char **s = strv_split(help, /* separators= */ NULL); + _cleanup_strv_free_ char **s = strv_split(verb->help, /* separators= */ NULL); if (!s) return log_oom(); diff --git a/src/shared/verbs.h b/src/shared/verbs.h index b7bc66fc19..7980db62fe 100644 --- a/src/shared/verbs.h +++ b/src/shared/verbs.h @@ -68,8 +68,15 @@ int _verbs_get_help_table(const Verb verbs[], const Verb verbs_end[], Table **re #define verbs_get_help_table(ret) \ _verbs_get_help_table(ALIGN_PTR(__start_SYSTEMD_VERBS), __stop_SYSTEMD_VERBS, ret) -#define VERB_COMMON_HELP(impl) \ - VERB(verb_help, "help", NULL, VERB_ANY, VERB_ANY, 0, "Show this help"); \ +#define _VERB_COMMON_HELP_IMPL(impl) \ static int verb_help(int argc, char **argv, uintptr_t data, void *userdata) { \ return impl(); \ } + +#define VERB_COMMON_HELP(impl) \ + VERB(verb_help, "help", NULL, VERB_ANY, VERB_ANY, 0, "Show this help"); \ + _VERB_COMMON_HELP_IMPL(impl) + +#define VERB_COMMON_HELP_HIDDEN(impl) \ + VERB(verb_help, "help", NULL, VERB_ANY, VERB_ANY, 0, NULL); \ + _VERB_COMMON_HELP_IMPL(impl)