From: ZIHCO Date: Wed, 26 Mar 2025 19:50:15 +0000 (+0100) Subject: ac-power: update the help output to use the ansi-color functions X-Git-Tag: v258-rc1~1000 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=72586a971b5ee26b6681fc34ba43c0081dbd94da;p=thirdparty%2Fsystemd.git ac-power: update the help output to use the ansi-color functions --- diff --git a/src/ac-power/ac-power.c b/src/ac-power/ac-power.c index af76b81de69..e184bc44322 100644 --- a/src/ac-power/ac-power.c +++ b/src/ac-power/ac-power.c @@ -2,9 +2,11 @@ #include +#include "ansi-color.h" #include "battery-util.h" #include "build.h" #include "main-func.h" +#include "pretty-print.h" static bool arg_verbose = false; @@ -13,14 +15,29 @@ static enum { ACTION_LOW, } arg_action = ACTION_AC_POWER; -static void help(void) { - printf("%s\n\n" - "Report whether we are connected to an external power source.\n\n" +static int help(void) { + _cleanup_free_ char *link = NULL; + int r; + + r = terminal_urlify_man("systemd-ac-power", "1", &link); + if (r < 0) + return log_oom(); + + printf("%1$s [OPTION]\n" + "\n%2$sReport whether we are connected to an external power source.%4$s\n" + "\n%3$sOptions:%4$s\n" " -h --help Show this help\n" " --version Show package version\n" " -v --verbose Show state as text\n" - " --low Check if battery is discharging and low\n", - program_invocation_short_name); + " --low Check if battery is discharging and low\n" + "\nSee the %3$s%5$s%4$s for details.\n", + program_invocation_short_name, + ansi_highlight(), + ansi_underline(), + ansi_normal(), + link); + + return 0; } static int parse_argv(int argc, char *argv[]) {