mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
ac-power: update the help output to use the ansi-color functions
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
#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[]) {
|
||||
|
||||
Reference in New Issue
Block a user