this post was submitted on 21 Sep 2023
51 points (100.0% liked)

Free and Open Source Software

18021 readers
8 users here now

If it's free and open source and it's also software, it can be discussed here. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] hallettj@beehaw.org 5 points 1 year ago (1 children)

Well I might be hooked. It didn't take me long to reproduce the niceties in Nushell I'm used to from my zsh config. Some of the important parts were setting up zoxide with a key binding for interactive mode, switching on vi key bindings, setting up my starship prompt.

Home Manager is preconfigured for the above integrations which made things easier.

One feature that is missing that I like to use is curly brace expansion to produce multiple arguments. For example,

$ mv *.{jpg,jpeg}

Unless there is a way to do something like this in Nushell that I haven't seen yet?

Something I enjoyed was automating a sequence of steps I've been running a lot lately due to a program that often partially crashes,

def nkill [name_substring] {
  ps | where name =~ $name_substring | each { |p| kill $p.pid; $p }
}

I realized after writing this that I basically recreated killall -r. But it's nice that it was so easy to make a custom command to do a very specific thing. And my version gives me a nice report of exactly what was killed.

Thanks for making this post OP! When I've heard mentions of Nushell I'm the past I think I conflated it with Powershell, and wrote it off as a Windows thing. (Maybe because it's introduced as being "like Powershell".) But now that I see that it's cross-platform I'm enjoying digging into it!

[–] tad_lispy@lemm.ee 2 points 1 year ago (1 children)

One feature that is missing that I like to use is curly brace expansion to produce multiple arguments. For example,

$ mv *.{jpg,jpeg}

Maybe this will work for expansion: https://github.com/nushell/nu_scripts/blob/main/modules/filesystem/expand.nu

It's in the "filesystem" section, but I think it works on any string, not only paths. See the ugly duck example. I didn't try it myself yet.

BTW the nu_scripts goodies are available in Nixpkgs, so since you are using Home Manager, it's easy to integrate. Take a look at my config for starters: https://gitlab.com/tad-lispy/nixos-configuration/-/blob/bb614ae3639a504912db167f5bd7e6651d28f604/tad.nix#L39-47

[–] hallettj@beehaw.org 1 points 1 year ago

Thanks for the tip about nu_scripts, those look handy!

The expand command is nice. I don't see how to use it to my mv command work. But that's not a huge deal.