From ce2529b4a26feba7b3b4a9802acccb0c002792bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 8 Oct 2019 18:19:59 +0200 Subject: 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/locale/localectl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/locale') diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 9fb5152110..5532e93255 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 ); -- cgit v1.2.3 From 455fa9610cba06af4cb9d8c8a2121b552c4d2229 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 1 Nov 2019 17:44:54 +0900 Subject: tree-wide: drop string.h when string-util.h or friends are included --- src/locale/keymap-util.c | 1 - src/locale/localectl.c | 1 - src/locale/localed.c | 1 - 3 files changed, 3 deletions(-) (limited to 'src/locale') diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c index f8c36c94f5..519dd0d188 100644 --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #include -#include #include #include #include diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 5532e93255..50c4c703f1 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -5,7 +5,6 @@ #include #include #include -#include #include "sd-bus.h" diff --git a/src/locale/localed.c b/src/locale/localed.c index 8d0eec96a5..baf0bd102b 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #include -#include #include #include #include -- cgit v1.2.3 From a969d606453ec7c3fee25fb30c02be4c4e6e5206 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 1 Nov 2019 17:56:33 +0900 Subject: tree-wide: drop locale.h when locale-util.h is included --- src/locale/localectl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/locale') diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 50c4c703f1..fb02bfd4a6 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -2,7 +2,6 @@ #include #include -#include #include #include -- cgit v1.2.3 From 353b2baa20c5a643c3de1eeee963f8a46af90feb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 15 Nov 2019 18:38:44 +0100 Subject: tree-wide: clean up --help texts a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This cleans up and unifies the outut of --help texts a bit: 1. Highlight the human friendly description string, not the command line via ANSI sequences. Previously both this description string and the brief command line summary was marked with the same ANSI highlight sequence, but given we auto-page to less and less does not honour multi-line highlights only the command line summary was affectively highlighted. Rationale: for highlighting the description instead of the command line: the command line summary is relatively boring, and mostly the same for out tools, the description on the other hand is pregnant, important and captions the whole thing and hence deserves highlighting. 2. Always suffix "Options" with ":" in the help text 3. Rename "Flags" → "Options" in one case 4. Move commands to the top in a few cases 5. add coloring to many more help pages 6. Unify on COMMAND instead of {COMMAND} in the command line summary. Some tools did it one way, others the other way. I am not sure what precisely {} is supposed to mean, that uppercasing doesn't, hence let's simplify and stick to the {}-less syntax And minor other tweaks. --- src/locale/localectl.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/locale') diff --git a/src/locale/localectl.c b/src/locale/localectl.c index fb02bfd4a6..6f2d37d222 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -383,16 +383,9 @@ static int help(void) { if (r < 0) return log_oom(); - 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" - " --no-ask-password Do not prompt for password\n" - " -H --host=[USER@]HOST Operate on remote host\n" - " -M --machine=CONTAINER Operate on local container\n" - " --no-convert Don't convert keyboard mappings\n\n" - "Commands:\n" + printf("%s [OPTIONS...] COMMAND ...\n\n" + "%sQuery or change system locale and keyboard settings.%s\n" + "\nCommands:\n" " status Show current locale settings\n" " set-locale LOCALE... Set system locale\n" " list-locales Show known locales\n" @@ -405,9 +398,17 @@ static int help(void) { " list-x11-keymap-variants [LAYOUT]\n" " Show known X11 keyboard mapping variants\n" " list-x11-keymap-options Show known X11 keyboard mapping options\n" + "\nOptions:\n" + " -h --help Show this help\n" + " --version Show package version\n" + " --no-pager Do not pipe output into a pager\n" + " --no-ask-password Do not prompt for password\n" + " -H --host=[USER@]HOST Operate on remote host\n" + " -M --machine=CONTAINER Operate on local container\n" + " --no-convert Don't convert keyboard mappings\n" "\nSee the %s for details.\n" - , ansi_highlight() , program_invocation_short_name + , ansi_highlight() , ansi_normal() , link ); -- cgit v1.2.3