-
Notifications
You must be signed in to change notification settings - Fork 125
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
Generate shell completion scripts #256
Generate shell completion scripts #256
Conversation
Hm ... I just noticed that the important dynamic completion of page names is unfortunately not yet supported by clap according to clap-rs/clap#1232. |
That is quite unfortunate and, for me personally, a deal breaker. I still like the move of @dbrgn How do you feel about the generated completions? |
Hmm, that's unfortunate indeed, I did't realize that this is not possible. I agree that this is a deal breaker. For now, I'd close this, and if someone has the motivation, that person could open a feature request in the clap repo. I also agree that moving the completions to a subdirectory makes sense. Regarding the moving of CLI definitions into a separate module: At first I didn't like it, but after some more thinking about it, I think it's a good change. @SimplyDanny do you want to open a new PR with the first commit, plus a commit that moves the completion files into a |
Sure. I will prepare separate PRs for the accepted changes. Keep in mind, though, that changes to the location of the completion scripts require updates of the packages (e.g. the Homebrew formula). I only generated them into an own folder, because their names would have changed anyway. |
Yes, I'm aware, but I think the change is worth it, because in the long run there may be additional completions as well, and if we keep them all in the root directory then it may get a bit messy. (The main reason why I didn't rename/move them before was that I wanted to investigate clap-generated completions first, in which case we could have removed the completions from the repository entirely and only generate them for the releases 🙂) |
Superseded by #258 and #259. Thanks @SimplyDanny! |
Shell completion scripts are generated in every release build.
The build script requires access to the definition of the command line arguments and options
Args
. This struct is moved into its own file to be able to import it separately together with itstypes
dependency.clap_complete
names the completion scriptstldr.bash
,tldr.fish
and_tldr
, respectively. As it seems, these defaults cannot be changed. If the previous names are preferred, the files must be renamed in the build script after their generation.The scripts are put into the
completion
directory where they are ignored from Git.This PR closes #220.