diff --git a/src/shared/help-util.c b/src/shared/help-util.c deleted file mode 100644 index 268f51bb74..0000000000 --- a/src/shared/help-util.c +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ - -#include -#include - -#include "ansi-color.h" -#include "help-util.h" -#include "path-util.h" - -/* These are helpers for putting together --help texts in a uniform way with a common output style: - * help_cmdline() outputs a brief summary of the command line syntax, and help_section() formats the - * headings of the individual sections of the --help text. */ - -void help_cmdline(const char *arguments) { - const char *progname = - last_path_component(secure_getenv("SYSTEMD_INVOKED_AS")) - ?: program_invocation_short_name; - - assert(arguments); - - printf("%s>%s %s %s\n", - ansi_grey(), - ansi_normal(), - progname, - arguments); -} - -void help_section(const char *title) { - assert(title); - - printf("\n%s%s:%s\n", - ansi_underline(), - title, - ansi_normal()); -} diff --git a/src/shared/help-util.h b/src/shared/help-util.h deleted file mode 100644 index 9b1072c720..0000000000 --- a/src/shared/help-util.h +++ /dev/null @@ -1,6 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -#pragma once - -void help_cmdline(const char *arguments); - -void help_section(const char *title); diff --git a/src/shared/meson.build b/src/shared/meson.build index ee395ffbe1..a8cea5b931 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -95,7 +95,6 @@ shared_sources = files( 'gnutls-util.c', 'gpt.c', 'group-record.c', - 'help-util.c', 'hibernate-util.c', 'hostname-setup.c', 'hwdb-util.c', diff --git a/src/shared/verbs.c b/src/shared/verbs.c index d63e069bae..1a1a2d9e59 100644 --- a/src/shared/verbs.c +++ b/src/shared/verbs.c @@ -6,11 +6,11 @@ #include "env-util.h" #include "extract-word.h" #include "format-table.h" -#include "help-util.h" #include "log.h" #include "nulstr-util.h" #include "options.h" #include "pager.h" +#include "path-util.h" #include "pretty-print.h" #include "string-util.h" #include "strv.h" @@ -513,6 +513,29 @@ static const Verb* verbs_find_cmd_verbs(const Verb *cmdverb, const Verb verbs_en return actual; } +static void help_cmdline(const char *arguments) { + const char *progname = + last_path_component(secure_getenv("SYSTEMD_INVOKED_AS")) + ?: program_invocation_short_name; + + assert(arguments); + + printf("%s>%s %s %s\n", + ansi_grey(), + ansi_normal(), + progname, + arguments); +} + +void help_section(const char *title) { + assert(title); + + printf("\n%s%s:%s\n", + ansi_underline(), + title, + ansi_normal()); +} + int _command_print_help_full( const Verb verbs[], const Verb verbs_end[], diff --git a/src/shared/verbs.h b/src/shared/verbs.h index ccfc403bab..a1eb671490 100644 --- a/src/shared/verbs.h +++ b/src/shared/verbs.h @@ -140,6 +140,8 @@ int _dispatch_verb(char **args, const Verb verbs[], const Verb verbs_end[], void #define dispatch_verb(args, userdata) \ _dispatch_verb(args, __start_SYSTEMD_VERBS, __stop_SYSTEMD_VERBS, userdata) +void help_section(const char *title); + #define VERB_COMMON_HELP_AUTO_FULL(program, help) \ VERB_FULL(verb_help_auto, "help", NULL, VERB_ANY, VERB_ANY, 0, /* dat= */ (uintptr_t) program, /* help= */ help) #define VERB_COMMON_HELP_AUTO_PROGRAM(program) VERB_COMMON_HELP_AUTO_FULL(program, "Show this help") diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c index cd8985cae7..384c53a8b7 100644 --- a/src/udev/udevadm-test-builtin.c +++ b/src/udev/udevadm-test-builtin.c @@ -4,7 +4,6 @@ #include "device-private.h" #include "device-util.h" -#include "help-util.h" #include "log.h" #include "options.h" #include "udev-builtin.h"