summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-23 18:11:05 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-23 18:11:05 +0100
commit455485185e4a452bbafb7121054249f319f7eda9 (patch)
tree46f809b4329e02502bc5fbcdaf812ab819eb4861
parentfix errors in getting current curves + add getting curent curves to tests + fix multimonitor mistakes in examples (diff)
downloadblueshift-455485185e4a452bbafb7121054249f319f7eda9.tar.gz
blueshift-455485185e4a452bbafb7121054249f319f7eda9.tar.bz2
blueshift-455485185e4a452bbafb7121054249f319f7eda9.tar.xz
add cmdline correctness test
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--TODO1
-rwxr-xr-xsrc/__main__.py14
2 files changed, 14 insertions, 1 deletions
diff --git a/TODO b/TODO
index 0e58971..18b64f3 100644
--- a/TODO
+++ b/TODO
@@ -2,7 +2,6 @@ Medium priority:
Small examples
-r support in the comperhensive example
Store settings so that we can transition from them instead of from clean
- Verify command line option correctness
Low priority:
Fix errors caused by SIGUSR2
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):