From e3e1691620c4791e662e4d8846b18295c1a018a2 Mon Sep 17 00:00:00 2001 From: Adrien Pensart Date: Tue, 4 May 2021 13:28:39 -0400 Subject: [PATCH] repr is erasing ANSI escapes codes --- src/click/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/click/core.py b/src/click/core.py index 010a2067c..c57b3b866 100644 --- a/src/click/core.py +++ b/src/click/core.py @@ -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 @@ -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)