scripts.helpers: improve get_opts_parser()
This commit is contained in:
parent
f44006535b
commit
45f088fa2b
1 changed files with 10 additions and 2 deletions
|
@ -30,9 +30,9 @@ def init_logging(options, name, report=None):
|
||||||
logging.basicConfig(level=loglevel, format=logformat, handlers=handlers)
|
logging.basicConfig(level=loglevel, format=logformat, handlers=handlers)
|
||||||
|
|
||||||
|
|
||||||
def get_opts_parser(just_try=False, progress=False):
|
def get_opts_parser(desc=None, just_try=False, just_one=False, progress=False):
|
||||||
""" Retrieve options parser """
|
""" Retrieve options parser """
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser(description=desc)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-v', '--verbose',
|
'-v', '--verbose',
|
||||||
|
@ -71,6 +71,14 @@ def get_opts_parser(just_try=False, progress=False):
|
||||||
help="Enable just-try mode"
|
help="Enable just-try mode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if just_one:
|
||||||
|
parser.add_argument(
|
||||||
|
'-J', '--just-one',
|
||||||
|
action="store_true",
|
||||||
|
dest="just_one",
|
||||||
|
help="Enable just-one mode"
|
||||||
|
)
|
||||||
|
|
||||||
if progress:
|
if progress:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--progress',
|
'-p', '--progress',
|
||||||
|
|
Loading…
Reference in a new issue