zsh-dwim: New Transformations for watch, modprobe, and dpkg

| Comments

I haven’t had a chance to update zsh-dwim in quite a while. I had a tiny spark of inspiration for a new transformation tonight, so I went ahead and implemented it. I also picked two other easy ideas off of my to-do list to implement, since the new idea was so tiny.

Tonight’s new idea

I was manually installing a couple of packages using dpkg. There were a couple of missing dependencies, so I immediately knew that I’d have to run apt-get -f install to pull those dependencies down. I was surprised that I was smart enough to realize that this was exactly the sort of case I was thinking of when I created zsh-dwim.

When dpkg --install fails due to missing dependencies it exits with a status of 2. Now, if you hit control-u when that happens zsh-dwim will be smart enough to give you back the apt-get -f install that you are looking for.

watch –> watch -n 10 –> watch -n 30 –> watch

I don’t know about you, but adjusting the interval of the watch command is something I do quite often, and I rarely remember to make the change until I’ve already punched in the entire command. With this new transformation I can just hit control-u repeatedly to cycle through various intervals.

modprobe –> modprobe -r –> modprobe

I’m not entirely certain how useful this one will be, but it was on my list. It was also very easy to implement, and I find these circular transformation interesting. We’ll see how it works out, if I manage to remember it is even there.