From 2a909e46d5d30122395024f0df3e65d58b881f0c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 17 Aug 2013 11:40:44 +0200 Subject: basic check for unsupported keywords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- auto-auto-complete.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2