Add --debug-exit argument and validity check
This commit is contained in:
parent
dc50c6ac3d
commit
3b87e7c297
@ -118,6 +118,9 @@ def get_argparser():
|
|||||||
action='append')
|
action='append')
|
||||||
debug.add_argument('--qt-flag', help="Pass an argument to Qt as flag.",
|
debug.add_argument('--qt-flag', help="Pass an argument to Qt as flag.",
|
||||||
nargs=1, action='append')
|
nargs=1, action='append')
|
||||||
|
debug.add_argument('--debug-flag', type=debug_flag_error,
|
||||||
|
help="Pass name of debugging feature to be turned on.",
|
||||||
|
nargs=1, action='append')
|
||||||
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
||||||
"startup.", metavar=':command')
|
"startup.", metavar=':command')
|
||||||
# URLs will actually be in command
|
# URLs will actually be in command
|
||||||
@ -144,6 +147,21 @@ def logfilter_error(logfilter: str):
|
|||||||
"filters: Invalid value {} - expected a list of: {}".format(
|
"filters: Invalid value {} - expected a list of: {}".format(
|
||||||
logfilter, ', '.join(log.LOGGER_NAMES)))
|
logfilter, ', '.join(log.LOGGER_NAMES)))
|
||||||
|
|
||||||
|
def debug_flag_error(flag):
|
||||||
|
"""Validate flags passed to --debug-flag.
|
||||||
|
|
||||||
|
Available flags:
|
||||||
|
debug-exit
|
||||||
|
pdb-postmortem
|
||||||
|
"""
|
||||||
|
valid_flags = ['debug-exit','pdb-postmortem']
|
||||||
|
|
||||||
|
if flag in valid_flags:
|
||||||
|
return flag
|
||||||
|
else:
|
||||||
|
raise argparse.ArgumentTypeError("Invalid flag - valid flags include: " +
|
||||||
|
str(valid_flags))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = get_argparser()
|
parser = get_argparser()
|
||||||
|
Loading…
Reference in New Issue
Block a user