diff --git a/tlmisc/optcomplete/optcomplete.py b/tlmisc/optcomplete/optcomplete.py index 9b2ff730c..1f5b66344 100644 --- a/tlmisc/optcomplete/optcomplete.py +++ b/tlmisc/optcomplete/optcomplete.py @@ -351,6 +351,15 @@ def autocomplete( parser, raise SystemExit( "Error: optparse option with a completer " "does not take arguments: %s" % str(option)) + + # Prev starts with '-' but no corresponding option could be + # identified. This is likely due to squashed short opts as in -a -b + # -c -> -abc, in which case we don't try to complete since it's not + # unambiguous which option completer to use. + elif not option: + sys.exit(exit_code) + + except KeyError: pass