Live data from Hacker News

Nushell: Introduction to a new kind of shell

dataswamp.org

131–140 of 252 posts

Re: Nushell: Introduction to a new kind of shell

#131

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…

bash + lua, and life is good again.

Re: Nushell: Introduction to a new kind of shell

#132

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

Eww. This is basically screen-scraping command output to enable structure-oriented commands. That means you need a scraper for every output, the scrapers need to be aware of all the options, handle filenames with whitespace correctly (not sure that's even possible in general).

And once you've done that, you have this new batch of commands that are structure-oriented, so you are using bash (for example) as a boot loader for your new shell. Why not just use the new shell?

I have a project in this space: https://marceltheshell.org. It is based on Python, so Python values (strings, numbers, tuples, lists, etc.) are piped between commands. No sublanguages (as in awk); instead you write Python functions.

Marcel has an ls command, but instead of producing a list of strings, it generates a stream of File objects which can be piped downstream to other commands that operate on Files.

Example: sum of file sizes under directory foobar:

    ls -f foobar | (f: f.size) | red +
-f means files only. In parens is a Python function (you can omit "lambda") that maps a file to its size. red + means reduce using addition, i.e., add up all the file sizes.

Or to compute size by file extension:

    ls -f foobar | (f: (f.suffix, f.size)) | red . +
f.suffix is the extension. "red . +" means to group by the first field of the tuple (the extension) and add up the sizes within each group.

Re: Nushell: Introduction to a new kind of shell

#135
post #131

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…

bash + lua, and life is good again.

How do you use bash and lua together?

Re: Nushell: Introduction to a new kind of shell

#136
post #96

Earlier quoted context omitted.

It has Push-Location and Pop-Location, which are aliased to pushd and popd. IDK about dirs -v.

`dirs -v` would be `Get-Location -Stack`. Also in newish versions PowerShell `Set-Location` (aliased to `cd`) supports -/+ to move backwards/forwards in it's own history, so usually you don't even need to bother with `pushd`/`popd` unless you need a named stack.

what about pushd 7 to go to the 7th path in the stack?

Re: Nushell: Introduction to a new kind of shell

#137
post #3

Should have been called nutshell

Nushell has the huge advantage of being searchable, which I think is really important for new projects where you need to look up docs often.

It is cumbersome to always add a postfix: rust (lang), go (lang), etc...

Re: Nushell: Introduction to a new kind of shell

#138
post #86

Earlier quoted context omitted.

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

> ArentCamelCaseMonstrocitiesOnlyMicrosoft --CouldLove Personally, CamelCase makes more sense than everythinglowercasesmushedinto -onetwothreefourparametersSometimesCapitalised and --sometimesdoubledashed and -Isometimesspacedoesn'tmatter -and --sometimes - "dashlivesalone" --AND -o -- "twodasheslivealone".

Not having used nushell, is that what it is like?
Post reply on HN