Skip to contentSkip to conversation

master - man/help: use separate common option lists

PATCH David Teigland 1 participant 1 message Feb 21, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c1ce371b59257a236115d2d6a3cb24af17faf55d
Commit:        c1ce371b59257a236115d2d6a3cb24af17faf55d
Parent:        b7ae57c6a6fd69d23cc8c180920ddca372914419
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Feb 21 14:32:54 2017 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Tue Feb 21 14:32:54 2017 -0600

man/help: use separate common option lists

There are two kinds of common options:
1. options common to all variants of a given command name
2. options common to all lvm commands

Previously, both kinds of common options were listed together under "Common options". Now the first are printed under "Common options for command" (when needed), and the second are printed under "Common options for lvm" (always).

---
 tools/command-lines.in |   14 ----
 tools/command.c        |  193 ++++++++++++++++++++++++++++++++++++++----------
 tools/command.h        |    3 +-
 tools/lvmcmdline.c     |    7 +-
 4 files changed, 160 insertions(+), 57 deletions(-)
tools/command-lines.in +0 -14
index 606d2e7..348e7a4 100644
@@ -191,20 +191,6 @@ OO_ALL: --commandprofile String, --config String, --debug,
 --verbose, --version, --yes, --test
 
 #
-# This list only applies to printing the usage text.
-# These common options are displayed once at the end of
-# a given command's usage.  This is done to avoid excessive
-# repetition of common options, which may obscure the more
-# interesting and relevant parts of a common prototype.
-# This definition is *only* used when generating the command
-# usage strings, and is the basis for the division between
-# the "usage" and "usage_common" strings. This OO defn does
-# not relate to which optional opts are accepted by commands,
-# which is defined by the OO line.
-#
-OO_USAGE_COMMON: OO_ALL, --force, --noudevsync
-
-#
 # options for pvs, lvs, vgs, fullreport
 #
 OO_REPORT: --aligned, --all, --binary, --configreport ConfigReport, --foreign,
tools/command.c +154 -39

279 lines not on this page · raw message

tools/command.h +2 -1
index 51c4551..c5c801a 100644
@@ -214,7 +214,8 @@ struct command {
 int define_commands(char *run_name);
 int command_id_to_enum(const char *str);
 void print_usage(struct command *cmd, int longhelp);
-void print_usage_common(struct command_name *cname, struct command *cmd);
+void print_usage_common_cmd(struct command_name *cname, struct command *cmd);
+void print_usage_common_lvm(struct command_name *cname, struct command *cmd);
 void factor_common_options(void);
 
 #endif
tools/lvmcmdline.c +4 -3
index ecb5802..02266c9 100644
@@ -1716,9 +1716,10 @@ static int _usage(const char *name, int longhelp)
 	}
 
 	/* Common options are printed once for all variants of a command name. */
-	if (longhelp)
-		print_usage_common(cname, cmd);
-	else
+	if (longhelp) {
+		print_usage_common_cmd(cname, cmd);
+		print_usage_common_lvm(cname, cmd);
+	} else
 		log_print("Use --longhelp to show all options.");
 
 	return 1;