Skip to content

Instantly share code, notes, and snippets.

@fdncred
Last active September 4, 2023 17:26
Show Gist options
  • Select an option

  • Save fdncred/df612ad99eb0bdacec8b8449eca07fa2 to your computer and use it in GitHub Desktop.

Select an option

Save fdncred/df612ad99eb0bdacec8b8449eca07fa2 to your computer and use it in GitHub Desktop.
nushell_with_uu

Nushell + UUtils = ❤️

We're happy to announce that with Nushell release 0.85.0, the nushell team is starting to integrate uutils/coreutils into nushell. The first command we have integrated is cp. So, when you use cp in this release, you're using the same code that it used in coreutils. 🎉 🥳

Many thanks to @tertsdiepraam, from the uutils team, and nushell contributor, @dmatos2012 for creating this first integration PR.

But why?

Nushell has been around since it's first public release in August 23rd, 2019. I think it's pretty safe to say that the concept of nushell has remained the same throughout the years, but wow have the internals changed. We've added commands, polished commands, removed commands, all to make nushell more composable and cohesive.

The story with open source remains the same. Contributors from a variety of backgrounds come in and submit pull requests. These PRs are usually things that author enjoys working on, because, let's admit it, people work on what they love and where their interest lies.

Watching Discord and Issues over the years, I began to see a trend. Some commands got a lot of attention, while others were mostly ignored. I think this must be a very common experience with open source maintainers.

One day, I had enough. I was so sick and tired of seeing issues and answering Discord questions around the nushell fileio idiosyncrasies with commands like cp, that I went and decided to integrate coreutils. My thought process was, "Why are we reinventing the wheel, when there is an excellent team of rust developers over at the uutils/coreutils repo already reinventing these commands that I was sick of having problems with?". And that's how the idea was born.

The idea being, let nushell be nushell and just integrate crates from top notch developers, like we already do. Once I started digging into coreutils, I was super pumped because the coreutils team had already started to make this easier for us. It's easier because all the coreutils commands are crates by themselves. So, that means we might be able to integrate the commands one at a time.

The more I investigated this, the more excited I got and decided to put up a draft PR to sketch out some ideas and integrating uu_cp. Soon after I noticed @terts joined Discord. I was thrilled to see one of the coreutils maintainers join our community. We struck up a quick friendship and I created a PR on the coreutils repo proposing an integration. After a little bit @dmatos2012 joined in the conversation and start working on a PR based on my draft. I was happy to see people joining as that were as excited as I was at the potential this could have.

Fast forward a few weeks and we had a nushell core-team meeting with @terts and @dmatos2012 joining. We discussed what we wanted to do and the implementation was completed. To stay true to nushell, we didn't impelment cp with the 30+ switches that it has right now in the uu_cp crate. We implemented the 8 parameters we thought would be most popular. This doesn't mean that we can't implement more, but we wanted to stick with the core functionality that we thought our community needed.

I think this is going to be a huge win-win because nushell gets to benefit from the awesome code base in coreutils with all the talented contributors over there, but coreutils also gets more exposure for being built into nushell. Not to mention, that doing the integration required the coreutils team to make things more modular, which means, it should be easier now for others to integrate.

What's next

The next step is to move onto other commands. I've created a list of command and we've categorized them as crawl, walk, run. The crawl commands are commands we believe to be pretty easy to impelment. The walk commands may be a bit trickier. The run commands, we're not sure about.

We don't plan on implementing every command from coreutils, but there are quite a few in the crawl category right now that shouldn't be super difficult to build in.

The next commands planned to implement, based on my notes above, are probably mv and rm.

Parting words

Again, thanks so much for the maintainers of uutils/coreutils. They have made great efforts to be as welcoming as possible to nushell. They have been wonderful to work with and we, at nushell, look forward to working more with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment