sigoden / argc-completions

{bash,zsh,fish,powershell,nushell}-completions for 1000+ commands.
MIT License
238 stars 13 forks source link

Help with nushell completions #41

Closed drmikecrowe closed 8 months ago

drmikecrowe commented 8 months ago

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 commented 8 months ago

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