Hugo’s article list piped through multiple Nushell built-ins
[!NOTE] The important bit
Jack — one of the cats — has recovered from whatever was bothering him with a little help from vet drugs. Thank goodness for that! Now I can get back to puttering.
I have been puttering a little here and there with Nushell, a command line shell in the spirit of Bash, Zsh, and Fish. It’s different from any of the above, though. It starts from the same “let me run my commands” starting point, but data handling, filtering, and transformation are core to Nu’s functionality.
You said something about Windows
Right. I have also been spending more time in Windows recently. No big deal. I bounce between emphasizing Windows and Linux on my hard drive routinely.
Installing Nushell with Winget
The Nushell documentation suggests using Winget. Lucky me, I happen to have played with that recently enough to remember it’s there.
That installed Nushell to my Program Files. nu.exe itself is under C:/Program Files/nu/bin. I run that and agree to everything — I don’t know Nushell all that well yet, and I certainly don’t know Nushell under Windows enough yet.
And it works!
Integrating with Windows Terminal
Windows Terminal is my preferred terminal emulator over in the Windows world. Though I could absolutely point and click my way through adding a Nushell profile, I’ll follow Setting the default shell and update settings.json myself.
Here are the relevant changes to my profile.
I add an entry for Nu Shell to the profile list, and make that entry my default in Windows Terminal. I chopped out everything not immediately relevant, so this is not a complete settings.json.
You can ignore my choices for font and color scheme. But if you do want exactly the same look, install the Nerd Fonts version of Fantasque Sans Mono and add this entry for Fairy Floss colors to the schemes section of your settings.json.
Integration with Starship
Nushell provides all sorts of customization options, but I prefer Starship’s cross-shell prompt setup. Unfortunately Starship is not yet available through Winget on my system. It is available through Chocolatey. It just so happens I have Chocolatey installed.
Open myself an administrator terminal by Control-clicking the PowerShell entry on my Windows Terminal menu, and away we go!
Nushell explicitly allows for multiple segments in your prompt, with PROMPT_COMMAND and PROMPT_COMMAND_RIGHT. I’ll keep their right-hand prompt, but use Starship for the left-hand prompt in my env.nu.
I’ll keep the Starship default config for now.
That’s pretty much it! I’m good to go explore the world of Nushell on Windows.
Sure but why
Well, now that I have all this set up along with a local checkout of the site’s current Hugo iteration, I can play with Hugo’s article listing.
Okay sure you can do exactly the same thing with some combination of a POSIX shell, GNU CoreUtils, and maybe xsv. Or just write Python code.
But I get all this in one tool! Hypothetically, a tool that works the same on Windows and Linux! And as I tooted at a friend while gushing over Nushell:
Now you no longer need two dozen separate tools installed on each of a million systems. Now you can do it all with one tool installed on a couple dozen systems wait hang on