/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "alloc-util.h"
-#include "ansi-color.h"
#include "battery-util.h"
#include "build.h"
#include "format-table.h"
+#include "help-util.h"
#include "log.h"
#include "main-func.h"
#include "options.h"
-#include "pretty-print.h"
#include "string-util.h"
static bool arg_verbose = false;
} arg_action = ACTION_AC_POWER;
static int help(void) {
- _cleanup_free_ char *link = NULL;
- _cleanup_(table_unrefp) Table *options = NULL;
int r;
- r = terminal_urlify_man("systemd-ac-power", "1", &link);
- if (r < 0)
- return log_oom();
-
+ _cleanup_(table_unrefp) Table *options = NULL;
r = option_parser_get_help_table(&options);
if (r < 0)
return r;
- printf("%s [OPTIONS...]\n"
- "\n%sReport whether we are connected to an external power source.%s\n"
- "\nOptions:\n",
- program_invocation_short_name,
- ansi_highlight(),
- ansi_normal());
+ help_cmdline("[OPTIONS...]");
+ help_abstract("Report whether we are connected to an external power source.");
+
+ help_section("Options:");
r = table_print_or_warn(options);
if (r < 0)
return r;
- printf("\nSee the %s for details.\n", link);
+ help_man_page_reference("systemd-ac-power", "1");
return 0;
}
#include "fdset.h"
#include "format-table.h"
#include "format-util.h"
+#include "help-util.h"
#include "log.h"
#include "main-func.h"
#include "notify-recv.h"
#include "options.h"
#include "parse-util.h"
#include "pidref.h"
-#include "pretty-print.h"
#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
STATIC_DESTRUCTOR_REGISTER(arg_fdname, freep);
static int help(void) {
- _cleanup_free_ char *link = NULL;
- _cleanup_(table_unrefp) Table *options = NULL;
int r;
- r = terminal_urlify_man("systemd-notify", "1", &link);
- if (r < 0)
- return log_oom();
-
+ _cleanup_(table_unrefp) Table *options = NULL;
r = option_parser_get_help_table(&options);
if (r < 0)
return r;
- printf("%1$s [OPTIONS...] [VARIABLE=VALUE...]\n"
- "%1$s [OPTIONS...] --exec [VARIABLE=VALUE...] ; -- CMDLINE...\n"
- "%1$s [OPTIONS...] --fork -- CMDLINE...\n"
- "\n%2$sNotify the init system about service status updates.%3$s\n\n",
- program_invocation_short_name,
- ansi_highlight(),
- ansi_normal());
+ help_cmdline("[OPTIONS...] [VARIABLE=VALUE...]");
+ help_cmdline("[OPTIONS...] --exec [VARIABLE=VALUE...] ; -- CMDLINE...");
+ help_cmdline("[OPTIONS...] --fork -- CMDLINE...");
+ help_abstract("Notify the init system about service status updates.");
+ help_section("Options:");
r = table_print_or_warn(options);
if (r < 0)
return r;
- printf("\nSee the %s for details.\n", link);
+ help_man_page_reference("systemd-notify", "1");
return 0;
}
#include "bus-util.h"
#include "capsule-util.h"
#include "extract-word.h"
+#include "help-util.h"
#include "image-policy.h"
#include "install.h"
#include "output-mode.h"
#include "parse-argument.h"
#include "parse-util.h"
#include "path-util.h"
-#include "pretty-print.h"
#include "static-destruct.h"
#include "string-table.h"
#include "string-util.h"
STATIC_DESTRUCTOR_REGISTER(arg_kill_subgroup, freep);
static int systemctl_help(void) {
- _cleanup_free_ char *link = NULL;
- int r;
-
pager_open(arg_pager_flags);
- r = terminal_urlify_man("systemctl", "1", &link);
- if (r < 0)
- return log_oom();
+ help_cmdline("[OPTIONS...] COMMAND ...");
+ help_abstract("Query or send control commands to the system manager.");
- printf("%1$s [OPTIONS...] COMMAND ...\n\n"
- "%5$sQuery or send control commands to the system manager.%6$s\n"
- "\n%3$sUnit Commands:%4$s\n"
- " list-units [PATTERN...] List units currently in memory\n"
+ help_section("Unit Commands:");
+ printf(" list-units [PATTERN...] List units currently in memory\n"
" list-automounts [PATTERN...] List automount units currently in memory,\n"
" ordered by path\n"
" list-paths [PATTERN...] List path units currently in memory,\n"
" reset-failed [PATTERN...] Reset failed state for all, one, or more\n"
" units\n"
" whoami [PID...] Return unit caller or specified PIDs are\n"
- " part of\n"
- "\n%3$sUnit File Commands:%4$s\n"
- " list-unit-files [PATTERN...] List installed unit files\n"
+ " part of\n");
+
+ help_section("Unit File Commands:");
+ printf(" list-unit-files [PATTERN...] List installed unit files\n"
" enable [UNIT...|PATH...] Enable one or more unit files\n"
" disable UNIT... Disable one or more unit files\n"
" reenable UNIT... Reenable one or more unit files\n"
" on specified one or more units\n"
" edit UNIT... Edit one or more unit files\n"
" get-default Get the name of the default target\n"
- " set-default TARGET Set the default target\n"
- "\n%3$sMachine Commands:%4$s\n"
- " list-machines [PATTERN...] List local containers and host\n"
- "\n%3$sJob Commands:%4$s\n"
- " list-jobs [PATTERN...] List jobs\n"
- " cancel [JOB...] Cancel all, one, or more jobs\n"
- "\n%3$sEnvironment Commands:%4$s\n"
- " show-environment Dump environment\n"
+ " set-default TARGET Set the default target\n");
+
+ help_section("Machine Commands:");
+ printf(" list-machines [PATTERN...] List local containers and host\n");
+
+ help_section("Job Commands:");
+ printf(" list-jobs [PATTERN...] List jobs\n"
+ " cancel [JOB...] Cancel all, one, or more jobs\n");
+
+ help_section("Environment Commands:");
+ printf(" show-environment Dump environment\n"
" set-environment VARIABLE=VALUE... Set one or more environment variables\n"
" unset-environment VARIABLE... Unset one or more environment variables\n"
- " import-environment VARIABLE... Import all or some environment variables\n"
- "\n%3$sManager State Commands:%4$s\n"
- " daemon-reload Reload systemd manager configuration\n"
+ " import-environment VARIABLE... Import all or some environment variables\n");
+
+ help_section("Manager State Commands:");
+ printf(" daemon-reload Reload systemd manager configuration\n"
" daemon-reexec Reexecute systemd manager\n"
" log-level [LEVEL] Get/set logging threshold for manager\n"
" log-target [TARGET] Get/set logging target for manager\n"
- " service-watchdogs [BOOL] Get/set service watchdog state\n"
- "\n%3$sSystem Commands:%4$s\n"
- " is-system-running Check whether system is fully running\n"
+ " service-watchdogs [BOOL] Get/set service watchdog state\n");
+
+ help_section("System Commands:");
+ printf(" is-system-running Check whether system is fully running\n"
" default Enter system default mode\n"
" rescue Enter system rescue mode\n"
" emergency Enter system emergency mode\n"
" hibernate Hibernate the system\n"
" hybrid-sleep Hibernate and suspend the system\n"
" suspend-then-hibernate Suspend the system, wake after a period of\n"
- " time, and hibernate"
- "\n%3$sOptions:%4$s\n"
- " -h --help Show this help\n"
+ " time, and hibernate\n");
+
+ help_section("Options:");
+ printf(" -h --help Show this help\n"
" --version Show package version\n"
" --system Connect to system manager\n"
" --user Connect to user service manager\n"
" --drop-in=NAME Edit unit files using the specified drop-in file name\n"
" --when=TIME Schedule halt/power-off/reboot/kexec action after\n"
" a certain timestamp\n"
- " --stdin Read new contents of edited file from stdin\n"
- "\nSee the %2$s for details.\n",
- program_invocation_short_name,
- link,
- ansi_underline(),
- ansi_normal(),
- ansi_highlight(),
- ansi_normal());
+ " --stdin Read new contents of edited file from stdin\n");
+
+ help_man_page_reference("systemctl", "1");
return 0;
}