diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-08-17 11:50:14 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-08-17 11:50:14 +0200 |
commit | b08507091b2168ebf938e3c0881c7d36f75ddf78 (patch) | |
tree | 87460d11c33f826870324a788c4d8c575d506057 /auto-auto-complete.py | |
parent | whoops, wrong variable name (diff) | |
download | auto-auto-complete-b08507091b2168ebf938e3c0881c7d36f75ddf78.tar.gz auto-auto-complete-b08507091b2168ebf938e3c0881c7d36f75ddf78.tar.bz2 auto-auto-complete-b08507091b2168ebf938e3c0881c7d36f75ddf78.tar.xz |
shell option do not need to be first
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'auto-auto-complete.py')
-rwxr-xr-x | auto-auto-complete.py | 8 |
1 files 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:]) |