Wrote up my thoughts on why #nushell matters. And yes, they get a bit spicy 😅
Wrote up my thoughts on why #nushell matters. And yes, they get a bit spicy 😅
@jntrnr #Nushell looks very interesting, thanks for the writeup!
I see that plugins can be made in any language that speaks JSON/MSGPACK¹, that's awesome.
The 'Coming from Bash' page² is also helpful.
Do you use #nushell as your actual shell? Or only for specific tasks?
¹https://www.nushell.sh/book/plugins.html
²https://www.nushell.sh/book/coming_from_bash.html
I've used it as my daily driver shell since the beginning. I also use it as my main scripting language, so all the scripts I write these days for various tasks are all Nushell.
@jntrnr i really appreciate the framing of "look it's really more of a scripting language project"
my main interaction with shells and shell scripting is "this is a temporary hell i get to live in when i want to bootstrap a usable environment with real tools and languages on a random machine"
...which necessarily precludes anything that isn't lowest-common-denominator. heck WSL defaults to /bin/sh being *dash* which is *weaker* than bash
@Gankra @jntrnr I get the "temporary hell" feeling when I'm in any shell other than bash 😅
(Well, or zsh and other similar ones.)
I used to write bash scripts long ago, but a recent foray into YunoHost debugging tells me I've lost the skill. My current scripting go-to is Perl, which makes it super simple to make pipe-friendly scripts. But would be awesome to have one language that's the shell as well as the scripting! 🐫
@jntrnr I generally agree with your intention that "we need something better", and in particular that it'd be nice to use structured data, but fact of the matter is, all applications emit just plaintext. Having to write separate plugins to give it form sounds no better than the current state of affairs, since they're third-party...
Not to mention—communication between two programs is still a matter of convention, just a different one. So I'm not sure much is gained there.
It's becoming increasingly common for apps (esp. modern cli apps) to optionally output json. This is a workable stand-in for outputting the structure directly, and it's easy for Nushell to take the json and use it.
Yeah, that resize/cursor position issue is one we're looking into. Not entirely sure what's causing it but would love to fix it.
@jntrnr the main reason I haven't tried it is an overload of new things and not enough time to try them all.
The one that has really worked is neovim, because I could adopt it incrementally. Can't do that with a new shell.
@jntrnr
Very well put.
I always annoyed by people who advocate things like Unix pipes but contend with existing commands that has most flags for input/output manipulation. If you really want to be consistent with Unix philosophy than one needs a structured shell and command just outputs structured data.
@jntrnr As someone building an `ls` with 45 arguments, you are absolutely right 😄 I know all the original utils quite well now and still feel **much** more comfortable scripting in nu than in bash.
I'm super excited for the collaboration between uutils and nushell. I hope that might help with removing some of that inertia by giving people more flags that they are used to from bash (but only the flags that make sense in nushell of course).
💯 💯
@finestructure uutils is a reimplementation of the GNU coreutils (and findutils) that I help maintain. We're collaborating with nushell to bring some of the commands over to nushell as built-in commands with good integration and pretty errors.
uutils homepage: https://uutils.github.io/
PR (very much WIP) to get uutils cp in nushell: https://github.com/nushell/nushell/pull/10097
@jntrnr mostly-irrelevant nit: zsh has a for loop shortcut that's even nicer than fish's imo: `for i in $(seq 1 10); echo $i` ; you give bash syntax in the article, which zsh supports, but that's a nice touch.
(I like and use nushell occasionally)
@jntrnr For me, anything above a line or two is automatically in Python or (preferably) Rust, so a new scripting language isn't the biggest priority. On the command-line, I rarely do data processing, so that also doesn't doesn't give me much incentive.
What I'm really intrigued by is the idea of using nushell as an embedded scripting language, as a modern TCL. I imagine that'd be a lot of work though.
@jntrnr I'm using #nushell for quite some time (over 2y now), but I got very simple needs, `cd` fire some command, ls, and git.
I happened to write few small scripts to process CSVs, cause it makes it quite easy.
bash/zsh are indeed old (and can be really slow), but changing them on remote machines is a no-go (where all the scripting usually requires posix shell).
I can't see good argument for fish tho, it's got different syntax and when I tried it - no windows support.
@jntrnr I went in to try it again, and nushell doesn't support the way that I do config, which is a blocker for me:
https://github.com/nushell/nushell/pull/8682
https://github.com/nushell/nushell/issues/893
Why in the world did the team decide to reject a user's choice of where the config should live? The PR gives no reasoning at all.
Description Use ~/.config/nushell as the primary location on all platforms & allow fallback to the existing os-specific locations. Fixes #893. Fixes #8256. Resolves #2918. Resolves #8263. User-Faci...
@jntrnr to expand a bit: an important part of shell config for me is that I can bring it between several computers on several operating systems; to do so I keep it in source control and in `~/.config`. (A few programs only support the root `~``, which isn't great but I live with it.)
nushell choosing to use only OS-specific directories means that I can't use my normal config system to move between OSes without adding significant complexity to my config system.
@jntrnr
Makes me want to try nushell again!
Most of my scripting needs these days are around exploring data from Sentry issues, where their web UI isn't good enough. I load a few dozen or thousands of events, throw certain properties into buckets, then see what different kind of root causes I can find. I often miss an option to easily cache the API response, which sometimes takes a minute to load all the data. I wonder how nushell fits in there?
Depends on how you like to do it, but I sometimes just immediately start by creating a new variable to put everything into.
```
let foo = (call to external website)
```
Then at least I don't have to call the website again, I have it in memory. Then, I can write it out to a file or process it or whatever.
Beyond that, we don't offer anything special for caching.
@jntrnr
Makes sense. It's probably easy enough to write a little file system caching abstraction that uses the URL as cache key.
Using nodejs works for this kind of scripting, but I think the interactivity of nushell would fit much better while exploring the data.
@jntrnr "Finally, a command
line shell for the 90s" is irony! It is a joke to emphasize that shells like Bash are too old and #FishShell has modern features.
Indeed, the first release of Fish was 2005.
I call that out the irony in the post. 😅
To your second point - fish *isn't* modern. That's why fish's creator started https://github.com/liljencrantz/crush which is another structured shell. I think that says a lot.
In practice, it's not this bad. Nushell comes with utilities to help handle output of external commands. It can also output text that's easy to parse.
Said another way it's no worst than posix for interop (text) but at its best it's much better.
they're not really a focus for me. I'm mostly focused on the structured data processing side
@jntrnr thanks for that writeup, I was aware of nushell before but now I'm motivated to give it a try.
I'm also intrigued by oil shell because it tries to be backwards compatible with bash. So a C++ to bash's C - and likewise that means lots of warts, but a straightforward adoption path for big projects and organizations already using bash extensively.