Commit 9cdb9578 authored by Iustin Pop's avatar Iustin Pop
Browse files

Unify the multiple 'verbose' options



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.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 4abc4f1e
......@@ -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.
......
......@@ -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"),
......
......@@ -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),
......
......@@ -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")
......
......@@ -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")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment