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
#diff --git a/cmds/filesystem.c b/cmds/filesystem.c
#index 4f22089abeaa..564dc40cc99a 100644
#--- a/cmds/filesystem.c
#+++ b/cmds/filesystem.c
#@@ -631,6 +631,7 @@ static const char * const
#cmd_filesystem_show_usage[] = {
# "-m|--mounted show only mounted btrfs",
# HELPINFO_UNITS_LONG,
# "If no argument is given, structure of all present filesystems
#is shown.",
#+ HELPINFO_INSERT_GLOBALS,
# NULL
# };
#
$ ./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.
(For example:)
$ ./btrfs fi show --help
<snip>
Global options:
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
common/help.c | 4 +---
common/help.h | 4 +++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/help.c b/common/help.c
index 189a1d3545c2..78f6ee99597c 100644
--- a/common/help.c
+++ b/common/help.c
@@ -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++) {
diff --git a/common/help.h b/common/help.h
index 01dfc68a7c8d..91874abfe207 100644
--- a/common/help.h
+++ b/common/help.h
@@ -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 "--foramt TYPE"
struct cmd_struct;
struct cmd_group;
--
1.8.3.1