nufmt icon indicating copy to clipboard operation
nufmt copied to clipboard

Update `example.nu` to valid nu script

Open AucaCoyan opened this issue 2 years ago • 7 comments

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

AucaCoyan avatar Jun 10 '23 01:06 AucaCoyan

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.

fdncred avatar Jun 10 '23 01:06 fdncred

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

amtoine avatar Jun 10 '23 08:06 amtoine

Yes, I believe that should be better!

AucaCoyan avatar Jun 10 '23 11:06 AucaCoyan

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

amtoine avatar Jun 10 '23 11:06 amtoine

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

amtoine avatar Jun 10 '23 11:06 amtoine

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 👍🏼

AucaCoyan avatar Jun 10 '23 11:06 AucaCoyan

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.

fdncred avatar Jun 10 '23 12:06 fdncred