sigoden/argc

Nushell Error: Automatically spreading lists is deprecated

TheJiahao opened this issue · 0 comments

With Nushell 0.89.0, the completion script generated by argc --argc-completions nushell causes error:

Error:   × Automatically spreading lists is deprecated
   ╭─[<pathToArgc>\argc-completions\tmp\argc-completions.nu:1:1]
 1  def _argc_completer [args: list<string>] {
 2      argc --argc-compgen nushell "" $args
   ·                                    ──┬──
   ·                                      ╰── Spreading lists automatically when calling external commands is deprecated and will be removed in 0.91.
 3          | split row "\n" | range 0..-2
   ╰────
  help: Use the spread operator (put a '...' before the argument)

Possible solution (breaking change)

Use spread operator (added in Nushell 0.89.0, won't work in previous versions) in ...$args.

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
}

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 
}