Skip to content

Commit

Permalink
repr is erasing ANSI escapes codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Pensart authored and davidism committed May 11, 2021
1 parent 1059c20 commit e3e1691
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/click/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@ def get_error_hint(self, ctx: Context) -> str:
indicate which param caused the error.
"""
hint_list = self.opts or [self.human_readable_name]
return " / ".join(repr(x) for x in hint_list)
return " / ".join(f"'{x}'" for x in hint_list)

def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]:
"""Return a list of completions for the incomplete value. If a
Expand Down Expand Up @@ -2926,7 +2926,7 @@ def get_usage_pieces(self, ctx: Context) -> t.List[str]:
return [self.make_metavar()]

def get_error_hint(self, ctx: Context) -> str:
return repr(self.make_metavar())
return f"'{self.make_metavar()}'"

def add_to_parser(self, parser: OptionParser, ctx: Context) -> None:
parser.add_argument(dest=self.name, nargs=self.nargs, obj=self)

0 comments on commit e3e1691

Please sign in to comment.