4imothy / treegrep

treegrep is a frontend for existing pattern matchers or a standalone pattern matcher which presents results in a tree format
MIT License
22 stars 2 forks source link

request: command to generate shell completion scripts #11

Closed minhtrancccp closed 1 month ago

minhtrancccp commented 1 month ago

per title, is it possible for the completions scripts to be generated on demand instead of manually linking them from $CARGO_HOME?

many thanks.

4imothy commented 1 month ago

Yes this is possible I will add a flag which takes the name of a shell and then prints the completion script for that shell to stdout. Is that what you were thinking of?

Something like

> tgrep --complete zsh
#compdef tgrep

...
minhtrancccp commented 1 month ago

that sounds right for me

4imothy commented 1 month ago

Sorry for taking a while but let me know if that is what you were looking for. Using code on main you can now do

tgrep --completions <shell>

To generate completions to stdout.