Nushell - A Great Shell (Command Line)
Nushell looks great as an interactive shell and for system scripting. I installed it and played around a bit.
The data driven approach and integrated utilities/functionalities provides great utility value. It natively supports querying data from for example json, ini, csv, sqlite, xml, yaml files.
open winget.json | get Sources.Packages.0 | sort-by PackageIdentifier | first 10 ls | where size < 100kb sys | get host.sessions.name sys | get host.os_version sys | get disks | sort-by free open murmur.sqlite | get slog | sort-by --reverse msgtime | first 10 open tmp.txt | find DE open tmp.txt | lines | length open Cargo.lock | from toml open foo.db | query db "select * from some_table" git log --pretty=%h»¦«%aN»¦«%s»¦«%aD | lines | split column "»¦«" sha1 committer desc merged_at | histogram committer merger | sort-by merger | reverse | first 10
❯ open winget.json | get Sources.Packages.0 | sort-by PackageIdentifier | first 10 ╭───┬────────────────────────────╮ │ # │ PackageIdentifier │ ├───┼────────────────────────────┤ │ 0 │ 7zip.7zip │ │ 1 │ AIMP.AIMP │ │ 2 │ Adobe.AdobeAcrobatReaderDC │ │ 3 │ Amazon.Games │ │ 4 │ BaldurKarlsson.RenderDoc │ │ 5 │ Bethesda.Launcher │ │ 6 │ BlenderFoundation.Blender │ │ 7 │ Blizzard.BattleNet │ │ 8 │ CPUID.CPU-Z │ │ 9 │ Canonical.Ubuntu │ ╰───┴────────────────────────────╯
It breaks with classic shells like bash and makes deliberate decisions for more clarity and consistency. So scripting is a little bit different, but I like the approaches. Variables are immutable, but shadowable. Logic takes more of a functional approach than procedural. Statements are scoped (no bleeding outwards of changed state). Execution is a one-step approach (think compile and run once).
Technology wise, piping uses structured, and it is developed in Rust. Nushell Source code on GitHub.
Nushell is available via winget.
winget install nushell.nushell
Starship shell prompt
Starship provides an alternative prompt (interactive interface state feedback). By default it provides concuse information in a useful, colored way.
Most importantly, it provides concise path information and error code visualization. Conveniently, it trims long paths, and shows git state. Colors and symbols are concise and soft.
Technology wise, it is developed in Rust. Starship source code on GitHub.
Starship is available via winget.
winget install Starship.Starship
To integrate Starship in nu:
mkdir ~/.cache/starship starship init nu | save ~/.cache/starship/init.nu
And I adjusted the configuration to show me path beyond Git workspace root and for 5 instead of 3 truncated path directories.
"$schema" = 'https://starship.rs/config-schema.json' [directory] truncate_to_repo = false truncation_symbol = "…/" truncation_length = 5