Currently multiple files define a 'verbose' option. This patch moves all
these definitions to a single VERBOSE_OPT option which is exported from
cli.py.
---
 lib/cli.py        |    5 +++++
 scripts/gnt-debug |    5 +----
 tools/burnin      |    4 +---
 tools/cfgupgrade  |    4 +---
 tools/lvmstrap    |    4 +---
 5 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 3841c9b..46510c3 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -54,6 +54,7 @@ __all__ = [
   "SYNC_OPT",
   "TAG_SRC_OPT",
   "USEUNITS_OPT",
+  "VERBOSE_OPT",
   # Generic functions for CLI programs
   "GenericMain",
   "GetClient",
@@ -459,6 +460,10 @@ _DRY_RUN_OPT = cli_option("--dry-run", default=False,
                                 " check steps and verify it it could be"
                                 " executed"))
 
+VERBOSE_OPT = cli_option("-v", "--verbose", default=False,
+                         action="store_true",
+                         help="Increase the verbosity of the operation")
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-debug b/scripts/gnt-debug
index cc7fcce..b582c5e 100755
--- a/scripts/gnt-debug
+++ b/scripts/gnt-debug
@@ -165,7 +165,7 @@ commands = {
              ],
             "[opts...] <duration>", "Executes a TestDelay OpCode"),
   'submit-job': (GenericOpCodes, [ArgFile(min=1)],
-                 [DEBUG_OPT,
+                 [DEBUG_OPT, VERBOSE_OPT,
                   cli_option("--op-repeat", type="int", default="1",
                              dest="rep_op",
                              help="Repeat the opcode sequence this number"
@@ -174,9 +174,6 @@ commands = {
                              dest="rep_job",
                              help="Repeat the job this number"
                              " of times"),
-                  cli_option("-v", "--verbose", default=False,
-                             action="store_true",
-                             help="Make the operation more verbose"),
                   cli_option("--timing-stats", default=False,
                              action="store_true",
                              help="Show timing stats"),
diff --git a/tools/burnin b/tools/burnin
index 45cff35..836b42a 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -114,9 +114,7 @@ OPTIONS = [
                  default=128, type="unit", metavar="<size>",
                  completion_suggest=("128M 256M 512M 1G 4G 8G"
                                      " 12G 16G").split()),
-  cli.cli_option("-v", "--verbose",
-                 action="store_true", dest="verbose", default=False,
-                 help="print command execution messages to stdout"),
+  cli.VERBOSE_OPT,
   cli.cli_option("--no-replace1", dest="do_replace1",
                  help="Skip disk replacement with the same secondary",
                  action="store_false", default=True),
diff --git a/tools/cfgupgrade b/tools/cfgupgrade
index 7ce75c1..d3984bf 100755
--- a/tools/cfgupgrade
+++ b/tools/cfgupgrade
@@ -287,9 +287,7 @@ def main():
                          " output file")
   parser.add_option(cli.FORCE_OPT)
   parser.add_option(cli.DEBUG_OPT)
-  parser.add_option('-v', '--verbose', dest='verbose',
-                    action="store_true",
-                    help="Verbose output")
+  parser.add_option(cli.VERBOSE_OPT)
   parser.add_option('--path', help="Convert configuration in this"
                     " directory instead of '%s'" % constants.DATA_DIR,
                     default=constants.DATA_DIR, dest="data_dir")
diff --git a/tools/lvmstrap b/tools/lvmstrap
index 73b4834..223f6fd 100755
--- a/tools/lvmstrap
+++ b/tools/lvmstrap
@@ -142,9 +142,7 @@ def ParseOptions():
   parser.add_option("-d", "--disks", dest="disks",
                     help="Choose disks (e.g. hda,hdg)",
                     metavar="DISKLIST")
-  parser.add_option("-v", "--verbose",
-                    action="store_true", dest="verbose", default=False,
-                    help="print command execution messages to stdout")
+  parser.add_option(cli.VERBOSE_OPT)
   parser.add_option("-r", "--allow-removable",
                     action="store_true", dest="removable_ok", default=False,
                     help="allow and use removable devices too")
-- 
1.6.3.3

Reply via email to