scripts.helpers: improve get_opts_parser()

This commit is contained in:
Benjamin Renard 2021-05-26 11:56:02 +02:00
parent f44006535b
commit 45f088fa2b

View file

@ -30,9 +30,9 @@ def init_logging(options, name, report=None):
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 """
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'-v', '--verbose',
@ -71,6 +71,14 @@ def get_opts_parser(just_try=False, progress=False):
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:
parser.add_argument(
'-p', '--progress',