From b08507091b2168ebf938e3c0881c7d36f75ddf78 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 17 Aug 2013 11:50:14 +0200 Subject: shell option do not need to be first 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/auto-auto-complete.py b/auto-auto-complete.py index 84acdd9..ac0993e 100755 --- a/auto-auto-complete.py +++ b/auto-auto-complete.py @@ -778,11 +778,11 @@ def main(shell, output, source): mane! ''' if __name__ == '__main__': - if len(sys.argv) != 6: + if len(sys.argv) == 0: print("USAGE: auto-auto-complete SHELL --output OUTPUT_FILE --source SOURCE_FILE") exit(2) - shell = sys.argv[1] + shell = None output = None source = None @@ -802,12 +802,14 @@ if __name__ == '__main__': if old is not None: abort('Duplicate option: ' + option) - for arg in sys.argv[2:]: + for arg in sys.argv[1:]: if option is not None: if option in aliases: option = aliases[option] useopt(option, arg) option = None + elif (shell is None) and not arg.startswith('-'): + shell = arg else: if '=' in arg: useopt(arg[:index('=')], arg[index('=') + 1:]) -- cgit v1.2.3-70-g09d2