I want to use fzf to search through all pages, not using tldr --search term
i.e. tldr $(tldr -l | fzf)
By just returning string by \n we could get this effect. return '\n'.join(commands)
def get_commands(platforms: Optional[List[str]] = None) -> str:
if platforms is None:
platforms = get_platform_list()
commands = []
if os.path.exists(get_cache_dir()):
for platform in platforms:
path = os.path.join(get_cache_dir(), 'pages', platform)
if not os.path.exists(path):
continue
commands += [file[:-3] for file in os.listdir(path) if file.endswith(".md")]
return '\n'.join(commands)
It returns a list of strings because it's used for searching. If we want to change to output the list as newline-separated values, this should be changed here (not within the actual function itself).
Hi there!
Thanks for this app!
Let me ask why it returns
list
when executingtldr -l
there ? https://github.com/tldr-pages/tldr-python-client/blob/15242e81e833f89a28a605cfb04ffed6a32af20c/tldr.py#L304C1-L315C20I want to use
fzf
to search through all pages, not usingtldr --search term
i.e.tldr $(tldr -l | fzf)
By just returning string by
\n
we could get this effect.return '\n'.join(commands)