From d5cf65c3660d2a85b389f1c094b8920896bdf995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=90=E3=82=AB=E3=81=A7=E3=81=99?= Date: Sun, 29 Oct 2023 09:17:25 +0300 Subject: [PATCH 1/3] fix: return `str` instead of `list` when executing `tldr -l` --- tldr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tldr.py b/tldr.py index bfae548..891f947 100755 --- a/tldr.py +++ b/tldr.py @@ -301,7 +301,7 @@ def get_page( PARAM_REGEX = re.compile(r'(?:{{)(?P.+?)(?:}})') -def get_commands(platforms: Optional[List[str]] = None) -> List[str]: +def get_commands(platforms: Optional[List[str]] = None) -> str: if platforms is None: platforms = get_platform_list() @@ -312,7 +312,7 @@ def get_commands(platforms: Optional[List[str]] = None) -> List[str]: if not os.path.exists(path): continue commands += [file[:-3] for file in os.listdir(path) if file.endswith(".md")] - return commands + return '\n'.join(commands) def colors_of(key: str) -> Tuple[str, str, List[str]]: From d75ff5f44a44507d3243832a211a8bbb9de80921 Mon Sep 17 00:00:00 2001 From: Lena <126529524+acuteenvy@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:06:33 +0100 Subject: [PATCH 2/3] Revert "fix: return `str` instead of `list` when executing `tldr -l`" This reverts commit d5cf65c3660d2a85b389f1c094b8920896bdf995. --- tldr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tldr.py b/tldr.py index 891f947..bfae548 100755 --- a/tldr.py +++ b/tldr.py @@ -301,7 +301,7 @@ def get_page( PARAM_REGEX = re.compile(r'(?:{{)(?P.+?)(?:}})') -def get_commands(platforms: Optional[List[str]] = None) -> str: +def get_commands(platforms: Optional[List[str]] = None) -> List[str]: if platforms is None: platforms = get_platform_list() @@ -312,7 +312,7 @@ def get_commands(platforms: Optional[List[str]] = None) -> str: if not os.path.exists(path): continue commands += [file[:-3] for file in os.listdir(path) if file.endswith(".md")] - return '\n'.join(commands) + return commands def colors_of(key: str) -> Tuple[str, str, List[str]]: From 95aaa7e67bea3ae78b03ea8f13f357da1ceeeacf Mon Sep 17 00:00:00 2001 From: Lena <126529524+acuteenvy@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:11:24 +0100 Subject: [PATCH 3/3] fix: return `str` instead of `list` when executing `tldr -l` --- tldr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tldr.py b/tldr.py index bfae548..fb2682d 100755 --- a/tldr.py +++ b/tldr.py @@ -504,7 +504,7 @@ def main() -> None: parser.print_help(sys.stderr) sys.exit(1) if options.list: - print(get_commands(options.platform)) + print('\n'.join(get_commands(options.platform))) elif options.render: for command in options.command: if os.path.exists(command):