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

feat(nushell): add nushell completion generation #1791

Merged
merged 1 commit into from Feb 29, 2024

Conversation

remmycat
Copy link
Contributor

As mentioned on Discord, I noticed that clap offers completion generation for nushell in a separate crate. I went ahead and implemented these for the existing gen-completions command.

Some extensive implementation notes:

  • When installing the new dependency, I also updated the clap and clap_complete versions in the manifests. I thought it couldn't hurt to have the whole group up to date when installing a new part. Looking at the lock file changes, I believe it had these versions already installed anyway.
  • I moved the gen-completions code into a new module, similar to the other commands. With the extra impl it took up quite a bit of space in mod.rs otherwise.
  • After trying out a few variants of composing the two crates into one command, I landed on defining an enum ourselves and adding some repetitive glue code. It was the most ergonomic version I could come up with, but I'm happy for alternative suggestions
  • Question: I'm not sure if the nushell generations are wanted in the release tarball? I just noticed it when searching for mentions of completions.
  • Another bit of code for the completions that I wasn't sure about was in atuin.nix. But the function used there, installShellCompletion, seems to only support bash fish and zsh in this way, so I didn't touch it (also I have next to no experience with nix, so I wouldn't want to break anything).
  • I tested the generated completions using the latest nushell version, 0.90.1, and everything worked well for me.
  • I'm gonna have a look at preparing a corresponding docs update PR tomorrow, or latest on the weekend, at least to update the list of supported shells for completion generation.

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! thank you!

@ellie ellie merged commit 5f0e6dd into atuinsh:main Feb 29, 2024
15 checks passed
@remmycat remmycat deleted the completions-nu branch February 29, 2024 11:26
ellie pushed a commit to atuinsh/docs that referenced this pull request Mar 1, 2024
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.

None yet

2 participants