Live data from Hacker News

Nushell: Introduction to a new kind of shell

dataswamp.org

81–90 of 252 posts

Re: Nushell: Introduction to a new kind of shell

#81

>This is just an example from YAML to JSON, but you can convert much more formats into other formats. >open dev/home-impermanence/tests/impermanence.yml | to json I can do it with PowerShell: $os_list = (Get-Content -Path "C:\temp\operating-systems.yml" | ConvertFrom-Yaml) Set-Content -Path "C:\temp\PowerShell_operating-systems.json" -Value ($os_list | ConvertTo-Json)

Probably better to write this with the standard alias's so people don't complain about verbosity:

  gc ./something.yml | ConvertFrom-Yaml | ConvertTo-Json > /some/file.json
Also I don't think ConvertFrom-Yaml actually exists as a standard cmdlet.

Re: Nushell: Introduction to a new kind of shell

#82

Earlier quoted context omitted.

I'm curious what you mean by "properly supports Windows." Are you on a version of Windows that supports WSL2 (Windows Subsystem for Linux)?

I really don't want to start up a separate Linux VM just to open up a shell. (I already crossed out Cygwin / MSYS on the list because of performance issues...)

Also, I need to compile actual Windows binaries using the shell (MSVC, clang-cl), and I obviously can’t do that under a Linux VM.

Re: Nushell: Introduction to a new kind of shell

#83

I just ported a bunch of scripts to nushell. I hit some bugs, a couple of which are a bit sharp, but wow, the list of quirks I have to remember for nutshell are so much fewer than for bash. Constantly impressed at the errors it catches at parse time, kinda crazy sometimes. Oh my god I could cry, strings are sane to work with. I may never write a bash script again (it's okay, I use Nix so I get nushell everywhere I'm…

> I may never write a bash script again

I wrote 2x 200 line-ish shell scripts recently, and it was simply terrible, and although I'm increasingly convinced we need a shell like abstraction, I can't believe `bash` is the best we can do. Really hope I find one of these alt shells that suits me. Not a fan of Python but xonsh looks really cool too.

Re: Nushell: Introduction to a new kind of shell

#84

Do we need a new shell or a few utilities that help produce structured output? For example, `ls | gen_structure | limit 50 | head 5`

That's an interesting project to attempt. An issue that should be considered is that pipes can only pass plain text. So every command should import/export structured text which may impact performance and limit capabilities when compared to a shell that can pipe objects.

Re: Nushell: Introduction to a new kind of shell

#85

Earlier quoted context omitted.

Well, it is a good point, since nowadays PowerShell is also cross-platform, and seems to have more features than nushell does. Though the true reason is: I haven't really found the time to. Changing a shell is really stressful since you have to unlearn / relearn lots of things from muscle memory, and PowerShell's huge deviance from the rest of the POSIX-y world doesn't help. At least in nushell `rm -rf` works, the sa…

> PowerShell's huge deviance from the rest of the POSIX-y world doesn't help In PowerShell (on Windows), `rm` is an alias to `Remove-Item`[0]. Therefore, rm -r -fo An extra dash, extra space, and extra letter isn't too bad by my books. Furthermore, in scripts, aliases are discouraged by PSScriptAnalyzer[1]; IDEs (PowerShell ISE, VS Code PowerShell extension) also support code completion, so: Remove-Item -Recurse -For…

why do they alias all this stuff. Remove Item is _not_ rm. It's so stupid. Like when they aliased wget and curl to some nonsense web request command and everybody complained that it didn't work.

I'll never use PowerShell. Just way too many bad decisions all over the place.

Re: Nushell: Introduction to a new kind of shell

#86
post #2

Nushell is PowerShell done right.

What are the features that are done differently, or in other words, why would I choose Nushell over PowerShell?

Error messages are great, autocomplete works out of the box, and commands ArentCamelCaseMonstrocitiesOnlyMicrosoft --CouldLove.

Re: Nushell: Introduction to a new kind of shell

#87

I use it as my primary driver, for the sole reason is that it's the only cross-platform shell that properly supports Windows (without resorting to Cygwin/MSYS, which has performance issues and many pain points). I'm still getting used to the syntax though... (Edit: forgot to mention Powershell, since nowadays it also works on Macs and Linux)

xonsh (Python based shell) works fine on Windows. Been using it for over 4 years.

Re: Nushell: Introduction to a new kind of shell

#88

Earlier quoted context omitted.

Why use this over PowerShell for example?

I am a C# programmer at heart, and I use powershell a good bit. I can honestly say I can never use powershell without my cheat sheets or my list of favorite commands (and especially the arguments to use). I looked at this and kinda get it and think I could do some things with it. I don't think it's as powerful and can _definitely_ say it won't be capable of the same automations we use. That said, the text parsing peo…

This is a common complaint among implementers of POSIX shells.

They are not LR-parsed languages, and cannot be expressed with yacc grammars.

Debian dash replaced bash as /bin/sh. It gains speed, but no better syntax.

https://archive.fosdem.org/2018/schedule/event/code_parsing_...

Re: Nushell: Introduction to a new kind of shell

#89

Earlier quoted context omitted.

I'm curious what you mean by "properly supports Windows." Are you on a version of Windows that supports WSL2 (Windows Subsystem for Linux)?

I really don't want to start up a separate Linux VM just to open up a shell. (I already crossed out Cygwin / MSYS on the list because of performance issues...)

Busybox for Windows has a very accessible shell.

Re: Nushell: Introduction to a new kind of shell

#90

I just ported a bunch of scripts to nushell. I hit some bugs, a couple of which are a bit sharp, but wow, the list of quirks I have to remember for nutshell are so much fewer than for bash. Constantly impressed at the errors it catches at parse time, kinda crazy sometimes. Oh my god I could cry, strings are sane to work with. I may never write a bash script again (it's okay, I use Nix so I get nushell everywhere I'm…

Honestly I’ve enjoyed working with PowerShell for scripts to work for all developers on my team regardless of what OS they are using.
Post reply on HN