nushell / nu_scripts

A place to share Nushell scripts with each other
MIT License
789 stars 231 forks source link

Can't run `custom-completions/auro-generate` scripts #968

Open mock1328 opened 1 month ago

mock1328 commented 1 month ago

Both doesn't work for me.

For parse-fish.nu the error is following:

> source parse-fish.nu
Error: nu::shell::variable_not_found

  × Variable not found
    ╭─[/home/mock/Downloads/nu_scripts/custom-completions/auto-generate/parse-fish.nu:6:35]
  5 │     # parse every .fish file in the current directory and make a .nu completions file of it
  6 │ ╭─▶ def build-completions-from-pwd [] {
  7 │ │       ls *.fish | par-each { |f|
  8 │ │           let out = ($f.name | str replace ".fish" ".nu")
  9 │ │           print $"building nushell completions from ($f.name)"
 10 │ │           build-completion $f.name $out
 11 │ │       }
 12 │ ├─▶ }
    · ╰──── variable not found
 13 │
    ╰────

For parse-help,nu:

> source parse-help.nu
> yay --help | parse-help | make-completion yay | save yay.nu
Error: nu::shell::eval_block_with_input

  × Eval block failed with pipeline input
   ╭─[/home/mock/Downloads/nu_scripts/custom-completions/auto-generate/parse-help.nu:6:11]
 5 │     # help format  '        -s,                      --long                   <format>                 description   '
 6 │     $in | parse -r '\s\s+(?:-(?P<short>\w)[,\s]+)?(?:--(?P<long>[\w-]+))\s*(?:<(?P<format>.*)>)?\s*(?P<description>.*)?'
   ·           ──┬──
   ·             ╰── source value
 7 │ }
   ╰────

Error: nu::shell::external_command

  × External command failed
    ╭─[/home/mock/Downloads/nu_scripts/custom-completions/auto-generate/parse-help.nu:13:13]
 12 │         build-string "\t--" $it.long (if ($it.short | is-empty) == false {
 13 │             build-string "(-" $it.short ")"
    ·             ──────┬─────
    ·                   ╰── Command `build-string` not found
 14 │         }) (if ($it.description | is-empty) == false {
    ╰────
  help: `build-string` is neither a Nushell built-in or a known external command
fdncred commented 1 month ago

It was written years ago now and probably needs to be updated to more recent nushell syntax.