Skip to content
Myr

Merge pull request #475 from jonafato/restore-option_name

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Restore option_name parameter to BadOptionUsage

authored by Armin Ronacher · committed by Armin Ronacher · parents d5f7713, f41b71c · Browse files · 2 files+7 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−4 removed

  • other:+7 added−4 removed

2 files+7 added−4 removed

modified:click/exceptions.py+4 added-1 removed
162 unmodified lines
163 was incorrect. This is for instance raised if the number of arguments164 for an option is not correct.165166 .. versionadded:: 4.0167168 :param option_name: the name of the option being used incorrectly.169 """170169 def __init__(self, message, ctx=None):171 def __init__(self, option_name, message, ctx=None):172 UsageError.__init__(self, message, ctx)173 self.option_name = option_name174175176class BadArgumentUsage(UsageError):177 """Raised if an argument is generally supplied but the use of the argument
27 unmodified lines
modified:click/parser.py+3 added-3 removed
72 unmodified lines
737475def _error_opt_args(nargs, opt):76 if nargs == 1:77 raise BadOptionUsage('%s option requires an argument' % opt)78 raise BadOptionUsage('%s option requires %d arguments' % (opt, nargs))77 raise BadOptionUsage(opt, '%s option requires an argument' % opt)78 raise BadOptionUsage(opt, '%s option requires %d arguments' % (opt, nargs))798081def split_opt(opt):82 first = opt[:1]
258 unmodified lines
341 value = tuple(state.rargs[:nargs])342 del state.rargs[:nargs]343344 elif explicit_value is not None:345 raise BadOptionUsage('%s option does not take a value' % opt)345 raise BadOptionUsage(opt, '%s option does not take a value' % opt)346347 else:348 value = None349
77 unmodified lines