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

Use clap to generate shell completions #290

Merged
merged 2 commits into from
May 25, 2020
Merged

Use clap to generate shell completions #290

merged 2 commits into from
May 25, 2020

Conversation

diatoner
Copy link
Contributor

Re: #288

Hopefully this is analogous to sharkdp/fd#66. Changes to ci/before_deploy.bash mirror sharkdp/fd when copying shell completions across.

This is the first PR I've submitted with Rust -- still learning OSS and Rust, so any feedback and I'll fix up what I can.

@sharkdp
Copy link
Owner

sharkdp commented May 21, 2020

This looks great. Thank you very much!

The automatic deployment in the release process can often be problematic, which leads to a spoiled release. It would be fantastic if you could set up TravisCI for your forked repository and create a fake release (by tagging your branch with some dummy version number, and then git push --tags) in order to make sure that everything works as expected (completion files are contained in the tarballs and the Debian packages). Let me know if that's too much to ask or if you need help.

I think you would need to:

  • Log into TravisCI with your GitHub account
  • Enable automatic builds for your fork of hyperfine
  • Tag the release and push

@sharkdp
Copy link
Owner

sharkdp commented May 24, 2020

I see you created a release. Did it work?

@diatoner
Copy link
Contributor Author

CI showed no issues; is that a decent indicator of checking to see if shell completions are installed correctly though?

Running ci/before_deploy.bash with the right parameters on my dev box and installing the relevant package manually ran with no errors, and checking for installed files:

/usr $ fd hyperfine
bin/hyperfine
share/doc/hyperfine
share/zsh/vendor-completions/_hyperfine
share/fish/completions/hyperfine.fish
share/bash-completion/completions/hyperfine
share/man/man1/hyperfine.1.gz

Can confirm completions are working locally. Is there a reliable way to confirm this across the board?

@sharkdp
Copy link
Owner

sharkdp commented May 25, 2020

Ok, thank you!

Downloading the release artifacts from your GitHub release page and manually inspecting the archives (and Debian packages) would be great.

@sharkdp
Copy link
Owner

sharkdp commented May 25, 2020

No artifacts seem to have been uploaded: https://github.com/four0000four/hyperfine/releases/tag/v1.9.02

Maybe you need to modify the deploy => api_key to make this work. Otherwise, I can also merge this and test myself.

@diatoner
Copy link
Contributor Author

Maybe you need to modify the deploy => api_key to make this work. Otherwise, I can also merge this and test myself.

Much appreciated -- I haven't looked into this, but I will, and will let you know if I hit a wall.

@diatoner
Copy link
Contributor Author

Shell completions are included in each:

@sharkdp
Copy link
Owner

sharkdp commented May 25, 2020

Awesome - very thorough! Thank you 👍

@sharkdp sharkdp merged commit 137329d into sharkdp:master May 25, 2020
@sharkdp sharkdp mentioned this pull request May 25, 2020
@sharkdp
Copy link
Owner

sharkdp commented May 25, 2020

Released as v1.10.0.

@shilangyu
Copy link

It seems like the PowerShell completions are generated but not included in any release file? Is that on purpose?

@sharkdp
Copy link
Owner

sharkdp commented Jun 1, 2020

Yes, it looks like https://github.com/sharkdp/hyperfine/blob/master/ci/before_deploy.ps1 should have been adapted, too. It would be great, if you could open a short new ticket.

@four0000four: FYI

@diatoner diatoner deleted the feature/shell-completions branch June 3, 2020 02:25
@diatoner diatoner restored the feature/shell-completions branch June 3, 2020 02:25
@diatoner
Copy link
Contributor Author

diatoner commented Jun 3, 2020

Thanks for pointing this out, definitely an oversight on my part.

@sharkdp for your confirmation: it looks like the .ps1 completion file generated by clap can be included in the .zip for a Windows download, and users can point to it manually in their PowerShell profiles. Is that suitable for #297?

@sharkdp
Copy link
Owner

sharkdp commented Jun 3, 2020

Yes, exactly

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

Successfully merging this pull request may close these issues.

3 participants