diff --git a/common/help.c b/common/help.c index 91c6b83b..5495d324 100644 --- a/common/help.c +++ b/common/help.c @@ -250,7 +250,9 @@ static int do_usage_one_command(const char * const *usagestr, * commands */ 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); for (i = 1; i < ARRAY_SIZE(output_formats); i++) { if (cmd_flags & output_formats[i].value) diff --git a/common/help.h b/common/help.h index 3380ed97..cb84cc37 100644 --- a/common/help.h +++ b/common/help.h @@ -39,27 +39,26 @@ struct cmd_group; #define ARGV0_BUF_SIZE PATH_MAX -#define HELPINFO_UNITS_LONG \ - "--raw raw numbers in bytes", \ - "--human-readable human friendly numbers, base 1024 (default)", \ - "--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \ - "--si use 1000 as a base (kB, MB, GB, TB)", \ - "--kbytes show sizes in KiB, or kB with --si", \ - "--mbytes show sizes in MiB, or MB with --si", \ - "--gbytes show sizes in GiB, or GB with --si", \ - "--tbytes show sizes in TiB, or TB with --si" +#define HELPINFO_UNITS_LONG \ + OPTLINE("--raw", "raw numbers in bytes"), \ + OPTLINE("--human-readable", "human friendly numbers, base 1024 (default)"), \ + OPTLINE("--iec", "use 1024 as a base (KiB, MiB, GiB, TiB)"), \ + OPTLINE("--si", "use 1000 as a base (kB, MB, GB, TB)"), \ + OPTLINE("--kbytes", "show sizes in KiB, or kB with --si"), \ + OPTLINE("--mbytes", "show sizes in MiB, or MB with --si"), \ + OPTLINE("--gbytes", "show sizes in GiB, or GB with --si"), \ + OPTLINE("--tbytes", "show sizes in TiB, or TB with --si") -#define HELPINFO_UNITS_SHORT_LONG \ - "-b|--raw raw numbers in bytes", \ - "-h|--human-readable", \ - " human friendly numbers, base 1024 (default)", \ - "-H human friendly numbers, base 1000", \ - "--iec use 1024 as a base (KiB, MiB, GiB, TiB)", \ - "--si use 1000 as a base (kB, MB, GB, TB)", \ - "-k|--kbytes show sizes in KiB, or kB with --si", \ - "-m|--mbytes show sizes in MiB, or MB with --si", \ - "-g|--gbytes show sizes in GiB, or GB with --si", \ - "-t|--tbytes show sizes in TiB, or TB with --si" +#define HELPINFO_UNITS_SHORT_LONG \ + OPTLINE("-b|--raw", "raw numbers in bytes"), \ + OPTLINE("-h|--human-readable", "human friendly numbers, base 1024 (default)"), \ + OPTLINE("-H", "human friendly numbers, base 1000"), \ + OPTLINE("--iec", "use 1024 as a base (KiB, MiB, GiB, TiB)"), \ + OPTLINE("--si", "use 1000 as a base (kB, MB, GB, TB)"), \ + OPTLINE("-k|--kbytes", "show sizes in KiB, or kB with --si"), \ + OPTLINE("-m|--mbytes", "show sizes in MiB, or MB with --si"), \ + OPTLINE("-g|--gbytes", "show sizes in GiB, or GB with --si"), \ + OPTLINE("-t|--tbytes", "show sizes in TiB, or TB with --si") #define HELPINFO_OPTION "\x01" #define HELPINFO_DESC "\x02" @@ -84,8 +83,8 @@ struct cmd_group; #define HELPINFO_INSERT_FORMAT "--format TYPE" -#define HELPINFO_INSERT_VERBOSE "-v|--verbose increase output verbosity" -#define HELPINFO_INSERT_QUIET "-q|--quiet print only errors" +#define HELPINFO_INSERT_VERBOSE OPTLINE("-v|--verbose", "increase output verbosity") +#define HELPINFO_INSERT_QUIET OPTLINE("-q|--quiet", "print only errors") /* * Descriptor of output format