From 32840f4ad65dd7c9abc5ef5d597ff452d98de305 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Sun, 25 Dec 2016 20:40:15 +0100 Subject: [PATCH] Add Clear to --optimizer-options, to unset all options. --- main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index d68c583..9fb7827 100755 --- a/main.py +++ b/main.py @@ -295,6 +295,9 @@ Case insensitive. is useless with 'optimize' and 'optsigns', and is of basically no use in general, other than to see where automatic casts happen. + Clear - Set all options to inactive, Normally used as the first + option, to start afresh. Note that this sets to inactive + even the options that are active by default. """) return @@ -345,14 +348,20 @@ def main(argv): Usage(argv[0], 'optimizer-options') return 0 - optchanges = arg.split(',') + optchanges = arg.lower().split(',') for chg in optchanges: + if chg in ('clear', '+clear'): + options = set() + continue + if chg == '-clear': + # ignore + continue if chg[0:1] not in ('+', '-'): chg = '+' + chg if chg[0] == '-': - options.discard(chg[1:].lower()) + options.discard(chg[1:]) else: - options.add(chg[1:].lower()) + options.add(chg[1:]) elif opt in ('-h', '--help'): Usage(argv[0])