tree-wide: clean up --help texts a bit
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.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
ce0d4c4f91
commit
353b2baa20
+21
-9
@@ -13,6 +13,8 @@
|
||||
#include "main-func.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "pretty-print.h"
|
||||
#include "terminal-util.h"
|
||||
#include "util.h"
|
||||
#include "verbs.h"
|
||||
#include "virt.h"
|
||||
@@ -22,19 +24,29 @@ static char **arg_path = NULL;
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_path, strv_freep);
|
||||
|
||||
static int help(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
printf("%s [COMMAND] [OPTIONS...]\n"
|
||||
"\n"
|
||||
"Mark the boot process as good or bad.\n\n"
|
||||
r = terminal_urlify_man("systemd-bless-boot.service", "8", &link);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
printf("%s [OPTIONS...] COMMAND\n"
|
||||
"\n%sMark the boot process as good or bad.%s\n"
|
||||
"\nCommands:\n"
|
||||
" good Mark this boot as good\n"
|
||||
" bad Mark this boot as bad\n"
|
||||
" indeterminate Undo any marking as good or bad\n"
|
||||
"\nOptions:\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Print version\n"
|
||||
" --path=PATH Path to the $BOOT partition (may be used multiple times)\n"
|
||||
"\n"
|
||||
"Commands:\n"
|
||||
" good Mark this boot as good\n"
|
||||
" bad Mark this boot as bad\n"
|
||||
" indeterminate Undo any marking as good or bad\n",
|
||||
program_invocation_short_name);
|
||||
"\nSee the %s for details.\n"
|
||||
, program_invocation_short_name
|
||||
, ansi_highlight()
|
||||
, ansi_normal()
|
||||
, link
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,16 +11,28 @@
|
||||
#include "bus-error.h"
|
||||
#include "log.h"
|
||||
#include "main-func.h"
|
||||
#include "pretty-print.h"
|
||||
#include "terminal-util.h"
|
||||
#include "util.h"
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
printf("%s [COMMAND] [OPTIONS...]\n"
|
||||
"\n"
|
||||
"Verify system operational state.\n\n"
|
||||
r = terminal_urlify_man("systemd-boot-check-no-failures.service", "8", &link);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
printf("%s [OPTIONS...]\n"
|
||||
"\n%sVerify system operational state.%s\n\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Print version\n",
|
||||
program_invocation_short_name);
|
||||
" --version Print version\n"
|
||||
"\nSee the %s for details.\n"
|
||||
, program_invocation_short_name
|
||||
, ansi_highlight()
|
||||
, ansi_normal()
|
||||
, link
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-2
@@ -1032,8 +1032,8 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
printf("%s [COMMAND] [OPTIONS...]\n\n"
|
||||
"Install, update or remove the systemd-boot EFI boot manager.\n"
|
||||
printf("%s [OPTIONS...] COMMAND ...\n"
|
||||
"\n%sInstall, update or remove the systemd-boot EFI boot manager.%s\n"
|
||||
"\nBoot Loader Commands:\n"
|
||||
" status Show status of installed systemd-boot and EFI variables\n"
|
||||
" install Install systemd-boot to the ESP and EFI variables\n"
|
||||
@@ -1046,6 +1046,7 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
" list List boot loader entries\n"
|
||||
" set-default ID Set default boot loader entry\n"
|
||||
" set-oneshot ID Set default boot loader entry, for next boot only\n"
|
||||
"\nOptions:\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Print version\n"
|
||||
" --esp-path=PATH Path to the EFI System Partition (ESP)\n"
|
||||
@@ -1056,6 +1057,8 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
" --no-pager Do not pipe output into a pager\n"
|
||||
"\nSee the %s for details.\n"
|
||||
, program_invocation_short_name
|
||||
, ansi_highlight()
|
||||
, ansi_normal()
|
||||
, link);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user