Beginning of CLI interface + protection against infinite recursion.

This commit is contained in:
Sybren A. Stüvel
2018-02-28 16:47:13 +01:00
parent 8ae400acbe
commit ca964181fe
14 changed files with 314 additions and 27 deletions
+16
View File
@@ -0,0 +1,16 @@
"""Common functionality for CLI parsers."""
def add_flag(argparser, flag_name: str, **kwargs):
"""Add a CLI argument for the flag.
The flag defaults to False, and when present on the CLI stores True.
"""
argparser.add_argument('-%s' % flag_name[0],
'--%s' % flag_name,
default=False,
action='store_true',
**kwargs)