From 455485185e4a452bbafb7121054249f319f7eda9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 23 Feb 2014 18:11:05 +0100 Subject: add cmdline correctness test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/__main__.py b/src/__main__.py index f189e16..d4c9d4d 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -356,6 +356,20 @@ output = parser.opts['--output'] if output is None: output = [] +if config_file is not None: + if any([doreset, location, gammas, rgb_brightnesses, cie_brightnesses, temperatures, output]): + print('--configurations can only be combined with --panicgate') + sys.exit(1) + +a = lambda opt : 0 if parser.opts[opt] is None else len(parser.opts[opt]) +for opt in ('--configurations', '--panicgate', '--reset', '--location'): + if a(opt) > 1: + print('%s can only be used once' % opt) + sys.exit(1) +for opt in ('--gamma', '--brightness', '++brightness', '--temperature'): + if a(opt) > 2: + print('%s can only be used up to two times' % opt) + sys.exit(1) settings = [gammas, rgb_brightnesses, cie_brightnesses, temperatures] if (config_file is None) and any([doreset, location] + settings): -- cgit v1.2.3-70-g09d2