nushell / nu_scripts

A place to share Nushell scripts with each other
MIT License
737 stars 227 forks source link

`use` of `parse-help` throws `nu::parser::expected_keyword` #586

Open selfagency opened 1 year ago

selfagency commented 1 year ago

this:

use ~/Developer/nu_scripts/custom-completions/auto-generate/parse-fish.nu

throws this:

Error: nu::parser::expected_keyword

  × Expected keyword.
    ╭─[/Users/daniel/Developer/nu_scripts/custom-completions/auto-generate/parse-fish.nu:86:1]
 86 │ 
 87 │ let quote = '"' # "
    · ─┬─
    ·  ╰── expected def, const, def-env, extern, extern-wrapped, alias, use, module, export or export-env keyword
 88 │ 
    ╰────
horasal commented 1 year ago

Could you try source prase-fish.nu?

Code containing non-function can only be used source but not use, I think?

It may be a good idea to make quote a function like

def quote [] {
    '"' # "
}
LoicRiegel commented 2 months ago

source parse-fish.nu does not raise an error on my side. The error is there when using use.

I just tried quickly to replace let quote = '"' # " by const quote = '"' # " and then it worked