diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-08-17 11:40:44 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-08-17 11:40:44 +0200 |
commit | 2a909e46d5d30122395024f0df3e65d58b881f0c (patch) | |
tree | 10cbf7c6c5f9e055911fa07bca9a9773dcdd677c | |
parent | cleaner fail (diff) | |
download | auto-auto-complete-2a909e46d5d30122395024f0df3e65d58b881f0c.tar.gz auto-auto-complete-2a909e46d5d30122395024f0df3e65d58b881f0c.tar.bz2 auto-auto-complete-2a909e46d5d30122395024f0df3e65d58b881f0c.tar.xz |
basic check for unsupported keywords
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-x | auto-auto-complete.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/auto-auto-complete.py b/auto-auto-complete.py index 9783804..32445e2 100755 --- a/auto-auto-complete.py +++ b/auto-auto-complete.py @@ -743,16 +743,24 @@ def main(shell, output, source): elif item[0] == 'default': default = item[1:]; - for group in (unargumented, argumented, variadic): + for (group, not_allowed) in ((unargumented, ['arg', 'suggest', 'files']), (argumented, []), (variadic, [])): for index in range(0, len(group)): item = group[index] map = {} for elem in item: + if elem[0] not in ('options', 'complete', 'arg', 'suggest', 'files', 'bind', 'desc'): + abort('Unrecognised keyword: ' + elem[0]) + if elem[0] in not_allowed: + abort('Out of context keyword: ' + elem[0]) map[elem[0]] = elem[1:] group[index] = map if default is not None: map = {} for elem in default: + if elem[0] not in ('arg', 'suggest', 'files', 'desc'): + abort('Unrecognised keyword: ' + elem[0]) + if elem[0] in ('bind', 'options', 'complete'): + abort('Out of context keyword: ' + elem[0]) map[elem[0]] = elem[1:] default = map |