Skip to content

Commit ac99ab8

Browse files
committed
Fix tab completion
1 parent f914e31 commit ac99ab8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tldr.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ def get_commands(platforms: Optional[List[str]] = None,
401401
path = get_cache_dir() / pages_dir / platform
402402
if not path.exists():
403403
continue
404-
commands += [f"{file.stem} ({language})"
404+
languagestring = ""
405+
if language != 'en':
406+
languagestring = f" ({language})"
407+
commands += [f"{file.stem}{languagestring}"
405408
for file in path.iterdir()
406409
if file.suffix == '.md']
407410
return commands
@@ -654,10 +657,10 @@ def create_parser() -> ArgumentParser:
654657

655658
shtab.add_argument_to(parser, preamble={
656659
'bash': r'''shtab_tldr_cmd_list(){{
657-
compgen -W "$("{py}" -m tldr --list | sed 's/[^[:alnum:]_]/ /g')" -- "$1"
660+
compgen -W "$("{py}" -m tldr --list)" -- "$1"
658661
}}'''.format(py=sys.executable),
659662
'zsh': r'''shtab_tldr_cmd_list(){{
660-
_describe 'command' "($("{py}" -m tldr --list | sed 's/[^[:alnum:]_]/ /g'))"
663+
_describe 'command' "($("{py}" -m tldr --list))"
661664
}}'''.format(py=sys.executable)
662665
})
663666

0 commit comments

Comments
 (0)