From 06b045475e8ace9d44e4bbc055bf6c69289383f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Thu, 27 Dec 2012 06:22:15 +0100 Subject: [PATCH] bug fix (cuased by typo) with preperation for future options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- ponysay.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ponysay.py b/ponysay.py index e8812f31..41e2ab71 100755 --- a/ponysay.py +++ b/ponysay.py @@ -302,16 +302,14 @@ class Ponysay(): self.ponydirs = self.vtponydirs if self.linuxvt and not self.usekms else self.xponydirs self.extraponydirs = self.extravtponydirs if self.linuxvt and not self.usekms else self.extraxponydirs - ## Variadic variants of -f, +f and -q - if args.opts['--f'] is not None: - if args.opts['-f'] is not None: args.opts['-f'] += args.opts['--f'] - else: args.opts['-f'] = args.opts['--f'] - if args.opts['++f'] is not None: - if args.opts['+f'] is not None: args.opts['+f'] += args.opts['++f'] - else: args.opts['+f'] = args.opts['++F'] - if args.opts['--q'] is not None: - if args.opts['-q'] is not None: args.opts['-q'] += args.opts['--q'] - else: args.opts['-q'] = args.opts['--q'] + ## Variadic variants of -f, -q &c + for sign in ('-', '+'): + for letter in ('f', 'F', 'q', 'Q'): + ssl = sign + sign + letter + sl = sign + letter + if (ssl in args.opts) and (args.opts[ssl] is not None): + if args.opts[sl] is not None: args.opts[sl] += args.opts[ssl] + else: args.opts[sl] = args.opts[ssl] ## Run modes if args.opts['-h'] is not None: args.help()