Nushell

An interesting new shell and programming language

Dr. Sasha Göbbels
https://shrtr.name/nushell

About me

  • Senior Engineering Manager
  • PhD in Theoretical Chemistry
  • ADHD, hyperfocus topics include:
    • Diversity & Inclusion
    • Fashion Theory& Fashion
    • Neuroscience & Empathy
  • Extroverted introvert
  • Trans femme

What is it?

  • Tired of too many new programming languages?
  • Confused by all the frameworks?
  • Experience the YAS (yet another shell) effect for a new level of being overwhelmed.
  • Nushell (https://www.nushell.sh/) is written in Rust
  • A shell designed as a programming language

Basics

Handling columns
ls | columns
ls | columns | select 1
Getting values
ls | get name
Filtering
ls | where size > 2kb
get vs. select
ls | get name
ls | select name

Opening files

open package.json
open package.json | get scripts

Text files and string handling

open people.txt
Get lines as strings
open people.txt | lines
Split lines at separator
open people.txt | lines | split column "|"
Get rid of white space
open people.txt | lines | split column "|" | str trim

More string goodness …

Get specific columns
open people.txt | lines | split column "|" | str trim | get column1
Renaming columns
open people.txt | lines | split column "|" fname lname job| str trim
Sort by a column
open people.txt | lines | split column "|" fname lname job| str trim | sort-by fname

URLs as files

http get https://blog.rust-lang.org/feed.xml
Confused? Look at the raw source
http get https://blog.rust-lang.org/feed.xml --raw | less

Hacking the GitHub REST API

Get repo data
http get https://api.github.com/repos/nushell/nushell
Where are the issues?
http get https://api.github.com/repos/nushell/nushell | get issues_url
Let's look at an issue
http get https://api.github.com/repos/nushell/nushell/issues/10740
Got labels?
http get https://api.github.com/repos/nushell/nushell/issues/10740 | get labels.name

Fin!