nushell / nufmt

MIT License
64 stars 8 forks source link

Update `example.nu` to valid nu script #23

Open AucaCoyan opened 1 year ago

AucaCoyan commented 1 year ago

example.nu is an old file. It's nice to have something to benchmark, but the issue is that currently is not valid nushell.

fdncred commented 1 year ago

This is how I generated the example.nu file.

$nu.scope.commands |
where is_builtin and (not $it.is_extern) |
get -i examples |
each {|r| $r.example? | append (char nl)} |
flatten | save -f example.nu

As you can see, this is just a dump of all the examples in all commands. Each is valid, but it's not valid as one lump of code.

amtoine commented 1 year ago

maybe we should just write a bunch of smaller benchmark files to measure different performance things?

AucaCoyan commented 1 year ago

Yes, I believe that should be better!

amtoine commented 1 year ago

this is the reason you closed #24, right? :yum:

amtoine commented 1 year ago

@AucaCoyan i agree with the comment you posted in the PR :+1:

AucaCoyan commented 1 year ago

Cool. I copy to have better issue readability

It's better to make a new file I guess. Because example.nu is script-generated, we shouldn't assume it will be constant over time. I would rather create another file. What do you think?

24 is available to re-open 👍🏼

fdncred commented 1 year ago

Right, it's probably better to have some other smaller samples or make a big file that is fully nushell compliant. There are several files on nu_scripts that are pretty long that don't change things but maybe query github or other things like that.

example.nu was used for me to test syntax highlighting and regular expressions in the vscode-nushell-lang extension. it was never really meant to be ran by itself.