From ce2529b4a26feba7b3b4a9802acccb0c002792bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 8 Oct 2019 18:19:59 +0200 Subject: [PATCH] Highlight the synopsis and summary in --help This doesn't cover all the binaries, but I don't know how to script this, and I run out of steam ;) --- src/busctl/busctl.c | 6 ++++-- src/coredump/coredumpctl.c | 6 ++++-- src/hostname/hostnamectl.c | 7 +++++-- src/locale/localectl.c | 7 +++++-- src/login/loginctl.c | 6 ++++-- src/machine/machinectl.c | 6 ++++-- src/network/networkctl.c | 6 ++++-- src/portable/portablectl.c | 6 ++++-- src/resolve/resolvectl.c | 8 +++++--- src/systemctl/systemctl.c | 5 +++-- src/timedate/timedatectl.c | 6 ++++-- 11 files changed, 46 insertions(+), 23 deletions(-) diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index e1055ff220b..8475c5bfddc 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -2230,8 +2230,8 @@ static int help(void) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] {COMMAND} ...\n\n" - "Introspect the bus.\n\n" + printf("%s%s [OPTIONS...] {COMMAND} ...\n\n" + "Introspect the bus.%s\n\n" "Commands:\n" " list List bus names\n" " status [SERVICE] Show bus service, process or bus owner credentials\n" @@ -2279,7 +2279,9 @@ static int help(void) { " system\n" " --destination=SERVICE Destination service of a signal\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 6ce0c297d85..4b972481d94 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -146,8 +146,8 @@ static int help(void) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...]\n\n" - "List or retrieve coredumps from the journal.\n" + printf("%s%s [OPTIONS...]\n\n" + "List or retrieve coredumps from the journal.%s\n" "\nCommands:\n" " list [MATCHES...] List available coredumps (default)\n" " info [MATCHES...] Show detailed information about one or more coredumps\n" @@ -168,7 +168,9 @@ static int help(void) { " -D --directory=DIR Use journal files from directory\n\n" " -q --quiet Do not show info messages and privilege warning\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index 1dfc0e68e6d..d98812d6daf 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -17,6 +17,7 @@ #include "main-func.h" #include "pretty-print.h" #include "spawn-polkit-agent.h" +#include "terminal-util.h" #include "util.h" #include "verbs.h" @@ -309,8 +310,8 @@ static int help(void) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] COMMAND ...\n\n" - "Query or change system hostname.\n" + printf("%s%s [OPTIONS...] COMMAND ...\n\n" + "Query or change system hostname.%s\n" "\nCommands:\n" " status Show current hostname settings\n" " set-hostname NAME Set system hostname\n" @@ -328,7 +329,9 @@ static int help(void) { " --static Only set static hostname\n" " --pretty Only set pretty hostname\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 9fb51521109..5532e932551 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -23,6 +23,7 @@ #include "set.h" #include "spawn-polkit-agent.h" #include "strv.h" +#include "terminal-util.h" #include "verbs.h" #include "virt.h" @@ -384,8 +385,8 @@ static int help(void) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] COMMAND ...\n\n" - "Query or change system locale and keyboard settings.\n\n" + printf("%s%s [OPTIONS...] COMMAND ...\n\n" + "Query or change system locale and keyboard settings.%s\n\n" " -h --help Show this help\n" " --version Show package version\n" " --no-pager Do not pipe output into a pager\n" @@ -407,7 +408,9 @@ static int help(void) { " Show known X11 keyboard mapping variants\n" " list-x11-keymap-options Show known X11 keyboard mapping options\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 4d11e686362..706a4e45fef 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -1280,8 +1280,8 @@ static int help(int argc, char *argv[], void *userdata) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] {COMMAND} ...\n\n" - "Send control commands to or query the login manager.\n" + printf("%s%s [OPTIONS...] {COMMAND} ...\n\n" + "Send control commands to or query the login manager.%s\n" "\nSession Commands:\n" " list-sessions List sessions\n" " session-status [ID...] Show session status\n" @@ -1329,7 +1329,9 @@ static int help(int argc, char *argv[], void *userdata) { " json, json-pretty, json-sse, json-seq, cat,\n" " with-unit)\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index c4fb11122b3..907f751ef29 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -2690,9 +2690,9 @@ static int help(int argc, char *argv[], void *userdata) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] {COMMAND} ...\n\n" + printf("%s%s [OPTIONS...] {COMMAND} ...\n\n" "Send control commands to or query the virtual machine and container\n" - "registration manager.\n" + "registration manager.%s\n" "\nMachine Commands:\n" " list List running VMs and containers\n" " status NAME... Show VM/container details\n" @@ -2762,7 +2762,9 @@ static int help(int argc, char *argv[], void *userdata) { " checksum, signature)\n" " --force Download image even if already exists\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/network/networkctl.c b/src/network/networkctl.c index d624bce1db6..5e8dce0b73c 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -1749,8 +1749,8 @@ static int help(void) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...]\n\n" - "Query and control the networking subsystem.\n" + printf("%s%s [OPTIONS...]\n\n" + "Query and control the networking subsystem.%s\n" "\nCommands:\n" " list [PATTERN...] List links\n" " status [PATTERN...] Show link status\n" @@ -1766,7 +1766,9 @@ static int help(void) { " -a --all Show status for all links\n" " -s --stats Show detailed link statics\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 9e160c10f32..2f8b0254c80 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -781,8 +781,8 @@ static int help(int argc, char *argv[], void *userdata) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] {COMMAND} ...\n\n" - "Attach or detach portable services from the local system.\n" + printf("%s%s [OPTIONS...] {COMMAND} ...\n\n" + "Attach or detach portable services from the local system.%s\n" "Commands:\n" " list List available portable service images\n" " attach NAME|PATH [PREFIX...]\n" @@ -810,7 +810,9 @@ static int help(int argc, char *argv[], void *userdata) { " --cat When inspecting include unit and os-release file\n" " contents\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index 59f312d55a1..ec4bffacba3 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -2523,10 +2523,10 @@ static int native_help(void) { if (r < 0) return log_oom(); - printf("%1$s [OPTIONS...] {COMMAND} ...\n" + printf("%s%s [OPTIONS...] {COMMAND} ...\n" "\n" "Send control commands to the network name resolution manager, or\n" - "resolve domain names, IPv4 and IPv6 addresses, DNS records, and services.\n" + "resolve domain names, IPv4 and IPv6 addresses, DNS records, and services.%s\n" "\nCommands:\n" " query HOSTNAME|ADDRESS... Resolve domain names, IPv4 and IPv6 addresses\n" " service [[NAME] TYPE] DOMAIN Resolve service (SRV)\n" @@ -2563,8 +2563,10 @@ static int native_help(void) { " (default: yes)\n" " --raw[=payload|packet] Dump the answer as binary data\n" " --legend=BOOL Print headers and additional info (default: yes)\n" - "\nSee the %2$s for details.\n" + "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index a2feb645b3b..98a71c44601 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -7651,8 +7651,8 @@ static int systemctl_help(void) { if (r < 0) return log_oom(); - printf("%1$s [OPTIONS...] {COMMAND} ...\n\n" - "Query or send control commands to the systemd manager.\n\n" + printf("%5$s%1$s [OPTIONS...] {COMMAND} ...\n\n" + "Query or send control commands to the systemd manager.%6$s\n\n" "%3$sUnit Commands:%4$s\n" " list-units [PATTERN...] List units currently in memory\n" " list-sockets [PATTERN...] List socket units currently in memory,\n" @@ -7802,6 +7802,7 @@ static int systemctl_help(void) { , program_invocation_short_name , link , ansi_underline(), ansi_normal() + , ansi_highlight(), ansi_normal() ); return 0; diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index c5d4d198fe1..2f9073c3dc5 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -809,8 +809,8 @@ static int help(void) { if (r < 0) return log_oom(); - printf("%s [OPTIONS...] COMMAND ...\n\n" - "Query or change system time and date settings.\n" + printf("%s%s [OPTIONS...] COMMAND ...\n\n" + "Query or change system time and date settings.%s\n" "\nCommands:\n" " status Show current time settings\n" " show Show properties of systemd-timedated\n" @@ -836,7 +836,9 @@ static int help(void) { " -a --all Show all properties, including empty ones\n" " --value When showing properties, only print the value\n" "\nSee the %s for details.\n" + , ansi_highlight() , program_invocation_short_name + , ansi_normal() , link ); -- 2.47.3