sigoden / argc-completions

{bash,zsh,fish,powershell,nushell}-completions for 1000+ commands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help with nushell completions

drmikecrowe opened this issue · comments

Thanks for helping me with my yq issues. I'm now seeing this when I activate with nushell:

show_media_bias  main @ 729bc98 ⩮✘∽⋄⇣ ❄️ devenv-shell❯ pnpm run Error:   × Automatically spreading lists is deprecated

I think it wants the code to be:

def _argc_completer [args: list<string>] {
    argc --argc-compgen nushell "" ...$args
...

However, when I make this change, I'm getting a leading | in my completion. Is this not the right fix?

image

My complete script is:

def _argc_completer [args: list<string>] {
    argc --argc-compgen nushell "" ...$args
        | split row "\n" | range 0..-2 
        | each { |line| $line | split column "\t" value description } | flatten 
}

let external_completer = {|spans| 
    _argc_completer $spans
}

$env.config.completions.external.enable = true
$env.config.completions.external.completer = $external_completer

Here's how it happens:

argc-issue-2

sigoden/argc#285 fixed nushell completion script.

In nushell, the leading indicator is dynamic, | for completion menu, ? for history/help menu.
https://github.com/nushell/nushell/blob/e7f1bf85350b4c2cf3e89ef39434b73c381730c8/crates/nu-cli/src/reedline_config.rs#L23

argc-completions2