btrfs-progs: convert common options to option formatter
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f7b5e6924a
commit
4996e4375c
|
@ -250,7 +250,9 @@ static int do_usage_one_command(const char * const *usagestr,
|
||||||
* commands
|
* commands
|
||||||
*/
|
*/
|
||||||
hpad(pad, outf);
|
hpad(pad, outf);
|
||||||
fprintf(outf, "--format TYPE where TYPE is: %s",
|
fprintf(outf, "%-*s where TYPE is: %s",
|
||||||
|
HELPINFO_OPTION_WIDTH,
|
||||||
|
"--format TYPE",
|
||||||
output_formats[0].name);
|
output_formats[0].name);
|
||||||
for (i = 1; i < ARRAY_SIZE(output_formats); i++) {
|
for (i = 1; i < ARRAY_SIZE(output_formats); i++) {
|
||||||
if (cmd_flags & output_formats[i].value)
|
if (cmd_flags & output_formats[i].value)
|
||||||
|
|
|
@ -39,27 +39,26 @@ struct cmd_group;
|
||||||
|
|
||||||
#define ARGV0_BUF_SIZE PATH_MAX
|
#define ARGV0_BUF_SIZE PATH_MAX
|
||||||
|
|
||||||
#define HELPINFO_UNITS_LONG \
|
#define HELPINFO_UNITS_LONG \
|
||||||
"--raw raw numbers in bytes", \
|
OPTLINE("--raw", "raw numbers in bytes"), \
|
||||||
"--human-readable human friendly numbers, base 1024 (default)", \
|
OPTLINE("--human-readable", "human friendly numbers, base 1024 (default)"), \
|
||||||
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
|
OPTLINE("--iec", "use 1024 as a base (KiB, MiB, GiB, TiB)"), \
|
||||||
"--si use 1000 as a base (kB, MB, GB, TB)", \
|
OPTLINE("--si", "use 1000 as a base (kB, MB, GB, TB)"), \
|
||||||
"--kbytes show sizes in KiB, or kB with --si", \
|
OPTLINE("--kbytes", "show sizes in KiB, or kB with --si"), \
|
||||||
"--mbytes show sizes in MiB, or MB with --si", \
|
OPTLINE("--mbytes", "show sizes in MiB, or MB with --si"), \
|
||||||
"--gbytes show sizes in GiB, or GB with --si", \
|
OPTLINE("--gbytes", "show sizes in GiB, or GB with --si"), \
|
||||||
"--tbytes show sizes in TiB, or TB with --si"
|
OPTLINE("--tbytes", "show sizes in TiB, or TB with --si")
|
||||||
|
|
||||||
#define HELPINFO_UNITS_SHORT_LONG \
|
#define HELPINFO_UNITS_SHORT_LONG \
|
||||||
"-b|--raw raw numbers in bytes", \
|
OPTLINE("-b|--raw", "raw numbers in bytes"), \
|
||||||
"-h|--human-readable", \
|
OPTLINE("-h|--human-readable", "human friendly numbers, base 1024 (default)"), \
|
||||||
" human friendly numbers, base 1024 (default)", \
|
OPTLINE("-H", "human friendly numbers, base 1000"), \
|
||||||
"-H human friendly numbers, base 1000", \
|
OPTLINE("--iec", "use 1024 as a base (KiB, MiB, GiB, TiB)"), \
|
||||||
"--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \
|
OPTLINE("--si", "use 1000 as a base (kB, MB, GB, TB)"), \
|
||||||
"--si use 1000 as a base (kB, MB, GB, TB)", \
|
OPTLINE("-k|--kbytes", "show sizes in KiB, or kB with --si"), \
|
||||||
"-k|--kbytes show sizes in KiB, or kB with --si", \
|
OPTLINE("-m|--mbytes", "show sizes in MiB, or MB with --si"), \
|
||||||
"-m|--mbytes show sizes in MiB, or MB with --si", \
|
OPTLINE("-g|--gbytes", "show sizes in GiB, or GB with --si"), \
|
||||||
"-g|--gbytes show sizes in GiB, or GB with --si", \
|
OPTLINE("-t|--tbytes", "show sizes in TiB, or TB with --si")
|
||||||
"-t|--tbytes show sizes in TiB, or TB with --si"
|
|
||||||
|
|
||||||
#define HELPINFO_OPTION "\x01"
|
#define HELPINFO_OPTION "\x01"
|
||||||
#define HELPINFO_DESC "\x02"
|
#define HELPINFO_DESC "\x02"
|
||||||
|
@ -84,8 +83,8 @@ struct cmd_group;
|
||||||
|
|
||||||
#define HELPINFO_INSERT_FORMAT "--format TYPE"
|
#define HELPINFO_INSERT_FORMAT "--format TYPE"
|
||||||
|
|
||||||
#define HELPINFO_INSERT_VERBOSE "-v|--verbose increase output verbosity"
|
#define HELPINFO_INSERT_VERBOSE OPTLINE("-v|--verbose", "increase output verbosity")
|
||||||
#define HELPINFO_INSERT_QUIET "-q|--quiet print only errors"
|
#define HELPINFO_INSERT_QUIET OPTLINE("-q|--quiet", "print only errors")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Descriptor of output format
|
* Descriptor of output format
|
||||||
|
|
Loading…
Reference in New Issue