zkit

zsh commands built on one idea: list a folder with numbers, then act on the numbers.

~/src
$ zls
  1   4.0K   3y  .editorconfig
  2   1.2G  2mo  data
  3    38M   5d  site <main ↑1|v2.3.0 +4>
  4   ~12G   0m  videos
$ zcd 3          # cd site
$ zupdate --all  # git pull --ff-only in every repo listed
$ zrm 2          # asks, then moves data to the trash

Every row gets a number, a size, how long ago it changed and, for repos, the branch, nearest tag and ahead/behind counts. Folder sizes are cached and re-measured in the background, so zls stays instant: ~ marks a size being refreshed, … one not measured yet.

install

homebrew
$ brew tap jonaprieto/zkit https://github.com/jonaprieto/zkit
$ brew trust --formula jonaprieto/zkit/zkit
$ brew install zkit
$ echo 'source $(brew --prefix)/share/zkit/zkit.zsh' >> ~/.zshrc

Or clone the repo and source path/to/zkit/zkit.zsh. Needs zsh and eza.

commands

// list
zls [DIR]number, size, age and name of every entry, dotfiles included
zls -s | -t | -stsort by size / age, biggest or oldest last; a second letter breaks ties
zls +1y | -5donly entries older / newer than that (m h d w mo y)
zls -rre-measure folder sizes now and wait
// act on the numbers
zcd Ncd into the numbered folder; anything else goes to plain cd
zrm [FLAGS] N...confirm, then trash (no flags) or rm FLAGS the entries
// git, per numbered repo or --all
zupdate N...|--all|.git pull --ff-only (or your flags), one line per repo
ztags N...|--all|. [-a]fetch and list tags newest first, with the branches containing them

Numbers always refer to the last zls in the current shell, in the order it was shown, so a sorted or filtered listing is what the next command acts on.

config