Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for shell autocompletion for pages #50

Closed
kbdharun opened this issue Dec 13, 2023 · 2 comments · Fixed by #51
Closed

Add support for shell autocompletion for pages #50

kbdharun opened this issue Dec 13, 2023 · 2 comments · Fixed by #51
Labels
enhancement New feature or request

Comments

@kbdharun
Copy link
Member

kbdharun commented Dec 13, 2023

Currently, in tlrc v1.8.0 installed via brew, the autocompletion doesn't seem to support displaying page possibilities. i.e. If I type tldr aws and press tab, the output should show all the possibilities for aws subcommands.

We support this feature in all our official clients. It would be great if tlrc supports it too.

Ways to implement it

@kbdharun kbdharun changed the title Add support for shell auto completion for pages Add support for shell autocompletion for pages Dec 13, 2023
@kbdharun kbdharun added the enhancement New feature or request label Dec 14, 2023
@acuteenvy
Copy link
Member

Use an external command

There's an option in the config to change the cache directory. We can't hard-code the path in the completion script.

Use a native Rust library

This is the current approach - generate completions automatically using clap_complete. The downside of this is that everything the completion suggests has to be known at compile-time, so we can't use it either.

Parse and use our existing JSON index

That is certainly possible, but would require caching the index somewhere and using some kind of JSON parser in the completion script, which adds an extra dependency.


I think the best solution is to use the output of tldr --list-all.

@kbdharun
Copy link
Member Author

I think the best solution is to use the output of tldr --list-all.

Yeah, that would work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants