Skip to content
Myr

issue #393: Show help hint only if there is a help option.

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

authored by Ryan Siemens · committed by Ryan Siemens · parent ddd8034 · Browse files · 1 file+7 added−3 removed
This commit

State

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

Diff stats

1 file+7 added−3 removed

  • other:+7 added−3 removed

1 file+7 added−3 removed

modified:click/exceptions.py+7 added-3 removed
42 unmodified lines
4344 def __init__(self, message, ctx=None):45 ClickException.__init__(self, message)46 self.ctx = ctx47 self.cmd = self.ctx and self.ctx.command or None4849 def show(self, file=None):50 if file is None:51 file = get_text_stderr()52 color = None53 hint = ''54 if (self.cmd is not None and55 self.cmd.get_help_option(self.ctx) is not None):56 hint = ('Try "%s %s" for help.\n'57 % (self.ctx.command_path, self.ctx.help_option_names[0]))58 if self.ctx is not None:59 color = self.ctx.color54 echo(self.ctx.get_usage() + '\nTry "%s %s" for help.\n'55 % (self.ctx.command_path, self.ctx.help_option_names[0]),56 file=file, color=color)60 echo(self.ctx.get_usage() + '\n%s' % hint, file=file, color=color)61 echo('Error: %s' % self.format_message(), file=file, color=color)626364class BadParameter(UsageError):
153 unmodified lines