Skip to content

The reason of returning list when tldr -l #221

Closed
@uunnxx

Description

@uunnxx

Hi there!

Thanks for this app!

Let me ask why it returns list when executing tldr -l there ?
https://github.com/tldr-pages/tldr-python-client/blob/15242e81e833f89a28a605cfb04ffed6a32af20c/tldr.py#L304C1-L315C20

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions