docs: improve size arguments description in --help output
Let's add "Arguments:" section to the --help output and describe {K,M,G...}iB suffixes there. Addresses: https://github.com/karelzak/util-linux/pull/917 Co-Author: ed <ed@s5h.net> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
67f938bfba
commit
f1970cc557
|
@ -363,6 +363,11 @@ static inline int xusleep(useconds_t usec)
|
||||||
, " -h, --help", USAGE_OPTSTR_HELP \
|
, " -h, --help", USAGE_OPTSTR_HELP \
|
||||||
, " -V, --version", USAGE_OPTSTR_VERSION
|
, " -V, --version", USAGE_OPTSTR_VERSION
|
||||||
|
|
||||||
|
#define USAGE_ARG_SEPARATOR "\n"
|
||||||
|
#define USAGE_ARG_SIZE(_name) \
|
||||||
|
_(" %s arguments may be followed by the suffixes for\n" \
|
||||||
|
" GiB, TiB, PiB, EiB, ZiB, and YiB (the \"iB\" is optional)\n"), _name
|
||||||
|
|
||||||
#define USAGE_MAN_TAIL(_man) _("\nFor more details see %s.\n"), _man
|
#define USAGE_MAN_TAIL(_man) _("\nFor more details see %s.\n"), _man
|
||||||
|
|
||||||
#define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
|
#define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
|
||||||
|
|
|
@ -86,7 +86,6 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(_( " -l, --list-one look up only first device with token specified by -t\n"), out);
|
fputs(_( " -l, --list-one look up only first device with token specified by -t\n"), out);
|
||||||
fputs(_( " -L, --label <label> convert LABEL to device name\n"), out);
|
fputs(_( " -L, --label <label> convert LABEL to device name\n"), out);
|
||||||
fputs(_( " -U, --uuid <uuid> convert UUID to device name\n"), out);
|
fputs(_( " -U, --uuid <uuid> convert UUID to device name\n"), out);
|
||||||
fputs(_( " <dev> specify device(s) to probe (default: all devices)\n"), out);
|
|
||||||
fputs( "\n", out);
|
fputs( "\n", out);
|
||||||
fputs(_( "Low-level probing options:\n"), out);
|
fputs(_( "Low-level probing options:\n"), out);
|
||||||
fputs(_( " -p, --probe low-level superblocks probing (bypass cache)\n"), out);
|
fputs(_( " -p, --probe low-level superblocks probing (bypass cache)\n"), out);
|
||||||
|
@ -99,6 +98,12 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(28));
|
printf(USAGE_HELP_OPTIONS(28));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<size> and <offset>")));
|
||||||
|
fputs(USAGE_ARG_SEPARATOR, out);
|
||||||
|
fputs(_(" <dev> specify device(s) to probe (default: all devices)\n"), out);
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("blkid(8)"));
|
printf(USAGE_MAN_TAIL("blkid(8)"));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,10 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(23));
|
printf(USAGE_HELP_OPTIONS(23));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<num>")));
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("mcookie(1)"));
|
printf(USAGE_MAN_TAIL("mcookie(1)"));
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
|
@ -658,6 +658,9 @@ usage(void)
|
||||||
|
|
||||||
printf(USAGE_HELP_OPTIONS(21));
|
printf(USAGE_HELP_OPTIONS(21));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, stdout);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<num>")));
|
||||||
|
|
||||||
fputs(USAGE_COLUMNS, stdout);
|
fputs(USAGE_COLUMNS, stdout);
|
||||||
for (i = 0; i < ARRAY_SIZE(infos); i++)
|
for (i = 0; i < ARRAY_SIZE(infos); i++)
|
||||||
fprintf(stdout, " %8s %s\n", infos[i].name, _(infos[i].help));
|
fprintf(stdout, " %8s %s\n", infos[i].name, _(infos[i].help));
|
||||||
|
|
|
@ -99,6 +99,9 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(21));
|
printf(USAGE_HELP_OPTIONS(21));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<num>")));
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("blkdiscard(8)"));
|
printf(USAGE_MAN_TAIL("blkdiscard(8)"));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,6 +322,9 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(24));
|
printf(USAGE_HELP_OPTIONS(24));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<sector> and <sectors>")));
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("blkzone(8)"));
|
printf(USAGE_MAN_TAIL("blkzone(8)"));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,9 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(22));
|
printf(USAGE_HELP_OPTIONS(22));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<num>")));
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("fallocate(1)"));
|
printf(USAGE_MAN_TAIL("fallocate(1)"));
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
|
@ -396,6 +396,10 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(21));
|
printf(USAGE_HELP_OPTIONS(21));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<num>")));
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("fstrim(8)"));
|
printf(USAGE_MAN_TAIL("fstrim(8)"));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,10 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(26));
|
printf(USAGE_HELP_OPTIONS(26));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<size>")));
|
||||||
|
|
||||||
printf(USAGE_MAN_TAIL("ipcmk(1)"));
|
printf(USAGE_MAN_TAIL("ipcmk(1)"));
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
|
@ -559,6 +559,9 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(27));
|
printf(USAGE_HELP_OPTIONS(27));
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<size>")));
|
||||||
|
|
||||||
fputs(USAGE_COLUMNS, out);
|
fputs(USAGE_COLUMNS, out);
|
||||||
for (i = 0; i < ARRAY_SIZE(infos); i++)
|
for (i = 0; i < ARRAY_SIZE(infos); i++)
|
||||||
fprintf(out, " %11s %s\n", infos[i].name, _(infos[i].help));
|
fprintf(out, " %11s %s\n", infos[i].name, _(infos[i].help));
|
||||||
|
|
|
@ -172,10 +172,14 @@ void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(_(" -n, --length <length> interpret only length bytes of input\n"), out);
|
fputs(_(" -n, --length <length> interpret only length bytes of input\n"), out);
|
||||||
fputs(_(" -s, --skip <offset> skip offset bytes from the beginning\n"), out);
|
fputs(_(" -s, --skip <offset> skip offset bytes from the beginning\n"), out);
|
||||||
fputs(_(" -v, --no-squeezing output identical lines\n"), out);
|
fputs(_(" -v, --no-squeezing output identical lines\n"), out);
|
||||||
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
printf(USAGE_HELP_OPTIONS(27));
|
printf(USAGE_HELP_OPTIONS(27));
|
||||||
printf(USAGE_MAN_TAIL("hexdump(1)"));
|
|
||||||
|
|
||||||
|
fputs(USAGE_ARGUMENTS, out);
|
||||||
|
printf(USAGE_ARG_SIZE(_("<length> and <offset>")));
|
||||||
|
|
||||||
|
printf(USAGE_MAN_TAIL("hexdump(1)"));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue