Skip to content

Add Nushell completion support - #109

Open
sidAKAsadiq wants to merge 1 commit into
prooflinedev:mainfrom
sidAKAsadiq:add-nushell-completions
Open

sidAKAsadiq wants to merge 1 commit into
prooflinedev:mainfrom
sidAKAsadiq:add-nushell-completions

Conversation

@sidAKAsadiq

Copy link
Copy Markdown

What

proofline completions already 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 proofline at 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::Shell can't be extended with a new variant directly, so
    Completions { shell } now takes a small CliShell enum
    (Builtin(clap_complete::Shell) | Nushell) that implements
    clap::ValueEnum itself, delegating to Shell's own implementation for
    the five existing values.
  • completions() dispatches on this enum, calling
    clap_complete_nushell::Nushell's generator for the new variant.
  • Updated the Completions command's help text and the README line that
    lists supported shells.

Testing

  • Extended tests/completions.rs's every_shell_gets_a_script_naming_the_visible_commands
    with a nushell case asserting the script contains module completions {
    and the same visible-command/hidden-command checks already applied to
    every other shell.
  • cargo test passes except two pre-existing failures unrelated to this
    change, confirmed present on unmodified main too:
    the_bash_script_completes_subcommands (environment lacks the
    bash-completion package) and
    update::tests::detached_discovery_is_serialized_and_notices_arrive_on_the_next_invocation
    (timing-sensitive, flaky on this machine).
  • cargo fmt --check and cargo clippy --bins --lib are clean. cargo clippy --all-targets reproduces two pre-existing lint errors in
    src/agent/tests.rs on unmodified main, unrelated to this change.

Manually verified the generated script in Nushell:
proofline completions nushell | save -f completions.nu then source completions.nu tab-completes commands and flags correctly.

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

No deployments
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.

1 participant