mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-11-13 18:13:31 +01:00
20 lines
545 B
Python
20 lines
545 B
Python
"""
|
|
Some preconfigured ArgumentParser
|
|
"""
|
|
|
|
from argparse import ArgumentParser
|
|
|
|
def MyArgumentParser(default_show_plots=False, **kwargs):
|
|
"""
|
|
A somewhat preconfigured ArgumentParser
|
|
|
|
Set show_plots=True to by default enable showing plots.
|
|
"""
|
|
parser = ArgumentParser(**kwargs)
|
|
|
|
# Whether to show plots
|
|
parser.add_argument('--show-plots', action='store_true')
|
|
parser.add_argument('--no-show-plots', dest='show-plots', action='store_false')
|
|
parser.set_defaults(show_plots=default_show_plots)
|
|
|
|
return parser
|