Repository navigation
Add Nushell completion support - #109
Open
sidAKAsadiq wants to merge 1 commit into
Open
sidAKAsadiq wants to merge 1 commit into
sidAKAsadiq wants to merge 1 commit into
Conversation
proofline completions already generates scripts for zsh, bash, fish, powershell and elvish via clap_complete::Shell. Nushell has no built-in generator in that crate, so add a CliShell wrapper enum that extends clap's ValueEnum with a Nushell variant backed by clap_complete_nushell, and dispatch to it in completions().
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
proofline completionsalready generates shell-completion scripts for zsh,bash, fish, powershell and elvish via
clap_complete::Shell. Nushell(https://www.nushell.sh) has no built-in generator in that crate, so this
adds one using
clap_complete_nushell.Who this helps
Nushell users currently get no tab-completion for
prooflineat all —they have to type full command/flag names from memory. This brings
Nushell to parity with the other five supported shells.
Decisions
clap_complete::Shellcan't be extended with a new variant directly, soCompletions { shell }now takes a smallCliShellenum(
Builtin(clap_complete::Shell) | Nushell) that implementsclap::ValueEnumitself, delegating toShell's own implementation forthe five existing values.
completions()dispatches on this enum, callingclap_complete_nushell::Nushell's generator for the new variant.Completionscommand's help text and the README line thatlists supported shells.
Testing
tests/completions.rs'severy_shell_gets_a_script_naming_the_visible_commandswith a
nushellcase asserting the script containsmodule completions {and the same visible-command/hidden-command checks already applied to
every other shell.
cargo testpasses except two pre-existing failures unrelated to thischange, confirmed present on unmodified
maintoo:the_bash_script_completes_subcommands(environment lacks thebash-completionpackage) andupdate::tests::detached_discovery_is_serialized_and_notices_arrive_on_the_next_invocation(timing-sensitive, flaky on this machine).
cargo fmt --checkandcargo clippy --bins --libare clean.cargo clippy --all-targetsreproduces two pre-existing lint errors insrc/agent/tests.rson unmodifiedmain, unrelated to this change.Manually verified the generated script in Nushell:
proofline completions nushell | save -f completions.nuthensource completions.nutab-completes commands and flags correctly.