btrfs-progs: split global help HELPINFO_INSERT_GLOBALS

As of now the define HELPINFO_INSERT_GLOBALS if used as in the example
as below (as of now its not been used anywhere) will print the help
texts as shown below

$ ./btrfs fi show --help

 <snip>

    Global options:
    --format TYPE      where TYPE is: text

So in preparation to add --verbose and --quiet global options, and
apparently --format is not being used yet, this patch splits the global
options into two defines.

                                       "Global options:"

So that the currently added global options --verbose and --quiet can use
the define HELPINFO_INSERT_GLOBALS header as shown below.

$ ./btrfs fi show --help
<snip>

    Global options:

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2019-11-25 18:39:02 +08:00 committed by David Sterba
parent 7e3f269cb9
commit b5a6cff94d
2 changed files with 4 additions and 4 deletions

View File

@ -209,15 +209,13 @@ static int do_usage_one_command(const char * const *usagestr,
fputc('\n', outf);
while (*usagestr) {
if (strcmp(*usagestr, HELPINFO_INSERT_GLOBALS) == 0) {
if (strcmp(*usagestr, HELPINFO_INSERT_FORMAT) == 0) {
int i;
fputc('\n', outf);
/*
* We always support text, that's on by default for all
* commands
*/
fprintf(outf, "%*sGlobal options:\n", pad, "");
fprintf(outf, "%*s--format TYPE where TYPE is: %s",
pad, "", output_formats[0].name);
for (i = 1; i < ARRAY_SIZE(output_formats); i++) {

View File

@ -57,7 +57,9 @@
* options and then continue with the following text that possibly follows
* after the regular options
*/
#define HELPINFO_INSERT_GLOBALS "INSERT_GLOBALS"
#define HELPINFO_INSERT_GLOBALS "", \
"Global options:"
#define HELPINFO_INSERT_FORMAT "--format TYPE"
struct cmd_struct;
struct cmd_group;