Skip to content

Commit

Permalink
Pass ctx to NoSuchOption exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Smith committed Sep 29, 2017
1 parent 752ff79 commit 1520fa4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions click/parser.py
Expand Up @@ -321,7 +321,7 @@ def _match_long_opt(self, opt, explicit_value, state):
if opt not in self._long_opt:
possibilities = [word for word in self._long_opt
if word.startswith(opt)]
raise NoSuchOption(opt, possibilities=possibilities)
raise NoSuchOption(opt, possibilities=possibilities, ctx=self.ctx)

option = self._long_opt[opt]
if option.takes_value:
Expand Down Expand Up @@ -364,7 +364,7 @@ def _match_short_opt(self, arg, state):
if self.ignore_unknown_options:
unknown_options.append(ch)
continue
raise NoSuchOption(opt)
raise NoSuchOption(opt, ctx=self.ctx)
if option.takes_value:
# Any characters left in arg? Pretend they're the
# next arg, and stop consuming characters of arg.
Expand Down

0 comments on commit 1520fa4

Please sign in to comment.