|
Have you seen nushell? It lets me one-liner so many things that would have previously taken breaking out a "real" language to do Contrived example: ls | where type == 'file' | sort-by size | take 4 | each {|f| {n: $f.name, s: ($f.size | format filesize MB) }} | to json
outputs {
"n": "clippy.toml",
"s": "0.000001 MB"
},
{
"n": "README.md",
"s": "0.000009 MB"
},
{
"n": "rustfmt.toml",
"s": "0.000052 MB"
},
{
"n": "typos.toml",
"s": "0.00009 MB"
}
|
Which isn't meant to "compete" - nushell looks nice -, but to show that the lower-threshold option for those of us who don't want to switch shells is to throw together a few helpers in a language... (you can get much closer to your example with another helper or two and a few more "evil" abuses of Ruby's darker corners, but I'm not sure it'd be worth it; I might a wrapper for the above in my bin/ though)