Skip to content

Blog post documenting our integration with uutils #1047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions blog/2023-09-05-why-uu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Nushell + Uutils = ❤️

We're happy to announce that with Nushell release 0.85.0, scheduled to be released on Sept 19, 2023, the nushell team is starting to integrate `uutils/coreutils` into nushell. The first command we have integrated is `cp`, that for a testing period lives in `ucp`. So, when you use `ucp` in this release, you're using the same code that it used in `coreutils`. 🎉 🥳

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

## But why?

Nushell has been around since it's first public release on 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 GitHub 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, specifically around the nushell fileio idiosyncrasies, with commands like `cp`, `mv`, `rm` that I went and decided to integrate coreutils. My thought process was, _"Why are we reinventing the wheel? There already is an excellent team of rust developers over at the uutils/coreutils repo who have done this. For these nushell commands, that don't get much love, but are the work-horses of a shell, why don't we use their code?"._ And that's how the idea was born.

The idea being, let nushell be nushell, parsing the parameters, nice command completions, and giving beautiful help & error messages, and just integrate crates from top notch developers, like we already do. Once I started digging into coreutils and looking at [@JT]'s early integration prototype/port of `df`, I was super pumped because the coreutils team had already started to make this easier for us. They did this by creating a crate for each utility. So, that means we could probably 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](https://github.com/nushell/nushell/pull/9463) to sketch out some ideas and integrating `uu_cp`. Soon after I noticed [@tertsdiepraam] 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](https://github.com/uutils/coreutils/issues/5088) on the coreutils repo proposing an integration. After a little bit [@dmatos2012] joined in the conversation and started working on a [PR](https://github.com/nushell/nushell/pull/10097) based on my draft. I was happy to see people joining, 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 [@tertsdiepraam] and [@dmatos2012] joining. We discussed what we wanted to do and the implementation was completed. To stay true to nushell, we didn't implement `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, and coreutils 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 their excellent utilites.

## What's next

First things first you can try out `ucp` as your regular `cp` by setting `alias cp = ucp`.
After we made sure to iron out the kinks, `cp` will become the `ucp` implementation.

The next step is to move onto integrating other commands, _your help is welcome and needed!!!_ I've created a list of command and we've categorized them as `crawl`, `walk`, `run`. We use this nominclature to describe that we want to start with the really "easy" commands first, then the next "easiest", then finally, what's left. [@JT] has helped me to learn the value of `crawl`, `walk`, `run` over the years, and that mantra frequently helps our team decide how we should implement new features.

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`. [Here's the spreadsheet](https://docs.google.com/spreadsheets/d/1MP9V8BTtcy_3DIUT8025yTcGrjkIJ-ZKFT0uvJFw0Lo/edit?usp=sharing) with categories.

## Parting words

Again, thanks so much to 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. If you'd like to contribute to the awesome coreutils project, you can find it [here](https://github.com/uutils/coreutils). I'm sure they'd love your support. If you'd like to chat with the nushell team about this on Discord, feel free to join in on the conversation [here]( https://discord.gg/NtAbbGn).

Sincerely,
[Darren](https://github.com/fdncred)
Sept 5th 2023

[@JT]: https://github.com/jntrnr
[@tertsdiepraam]: https://github.com/tertsdiepraam
[@dmatos2012]: https://github.com/dmatos2012