return True, opt
elif opt + '=?' in possibilities:
return '?', opt
- # No exact match, so better be unique.
+ # Possibilities must be unique to be accepted
if len(possibilities) > 1:
- # XXX since possibilities contains all valid continuations, might be
- # nice to work them into the error msg
- raise GetoptError(_('option --%s not a unique prefix') % opt, opt)
+ raise GetoptError(
+ _("option --%s not a unique prefix; possible options: %s")
+ % (opt, ", ".join(possibilities)),
+ opt,
+ )
assert len(possibilities) == 1
unique_match = possibilities[0]
if unique_match.endswith('=?'):
option -%s not recognized
option -%s requires argument
option --%s must not have an argument
-option --%s not a unique prefix
+option --%s not a unique prefix; possible options: %s
option --%s not recognized
option --%s requires argument
\ No newline at end of file