feat(cli): replace the classic coreutils tools with modern equivalents
Adds Rust/Go replacements for the day-to-day utilities and shadows four of them with aliases. Only read-only commands are shadowed (cat, du, df, ps), so a wrong flag costs a retype rather than data; rm, grep, find and sed keep their originals and the replacements are reached by their own names. The aliases land in .zshrc, so they apply to interactive zsh only -- scripts, `sudo <cmd>` and anything exec'd by another program still get the real binary. New on every host: dust, dysk, procs, trash-cli, doggo, xh, ouch, jnv, hexyl, fq and tealdeer. dysk is used rather than duf, which is unmaintained upstream. git gains difftastic behind a `git dft` alias. diff.external is deliberately left unset so delta remains the renderer for git diff/show and for anything parsing them. The work box gains kubecolor, aliased over kubectl; it wraps the real kubectl and drops colour when stdout is not a terminal, so pipes are unchanged. home/README.md documents the alias map, the flag incompatibilities (including the two that fail silently: dust -s is --apparent-size, and procs reads a bare `aux` as a search keyword) and the rationale for what was left alone.
This commit is contained in:
@@ -26,8 +26,32 @@ in
|
||||
pkgs.tea
|
||||
pkgs.hyperfine # command-line benchmarking
|
||||
pkgs.sd # saner find-and-replace than sed
|
||||
|
||||
# Replacements for the classic coreutils/BSD tools. Only the read-only ones
|
||||
# are aliased over the original name (see shellAliases below); the rest keep
|
||||
# their own name so nothing changes shape under a script's feet. The alias
|
||||
# map and the flag-compatibility differences are documented in
|
||||
# ./README.md, "Replacing the classics".
|
||||
pkgs.dust # du: tree-shaped, size-sorted disk usage
|
||||
pkgs.dysk # df: mounted filesystems (duf is unmaintained upstream)
|
||||
pkgs.procs # ps: process list with tree, ports and container columns
|
||||
pkgs.trash-cli # rm: XDG trash; `trash` / `trash-list` / `trash-restore`
|
||||
pkgs.doggo # dig: DNS lookups
|
||||
pkgs.xh # curl, for interactive HTTP poking (curl stays for scripts)
|
||||
pkgs.ouch # tar/unzip/7z/zstd: one command for every archive format
|
||||
pkgs.jnv # interactive jq filter builder (jq itself stays for scripts)
|
||||
pkgs.hexyl # hex viewer
|
||||
pkgs.fq # jq for binary formats
|
||||
];
|
||||
|
||||
# tldr pages: worked examples for a command, next to (not instead of) man.
|
||||
# enableAutoUpdates defaults on and installs a tldr-update user timer, which
|
||||
# keeps the page cache fresh -- without it `tldr` fails until first `--update`.
|
||||
programs.tealdeer = {
|
||||
enable = true;
|
||||
settings.display.compact = true;
|
||||
};
|
||||
|
||||
# Resource monitor, themed Catppuccin Mocha to match the rest of the desktop.
|
||||
# btop does not bundle the theme, so vendor it from catppuccin/btop (pinned).
|
||||
programs.btop = {
|
||||
@@ -137,6 +161,26 @@ in
|
||||
la = "eza --icons --git -la";
|
||||
lt = "eza --icons --git --tree";
|
||||
cls = "clear";
|
||||
|
||||
# Shadow the classics with their modern equivalents. Only read-only
|
||||
# commands are shadowed: a wrong flag costs a retype, never data. The
|
||||
# flag vocabularies are NOT compatible (`du -sh`, `df -h`, `ps aux` all
|
||||
# fail here) -- see ./README.md, "Replacing the classics".
|
||||
#
|
||||
# Blast radius is bounded by where these live: shellAliases lands in
|
||||
# .zshrc, so only interactive zsh sees them. Scripts, `sudo <cmd>` and
|
||||
# anything exec'd by another program still get the real binary. To reach
|
||||
# the original in an interactive shell: `command du` or `\du`.
|
||||
cat = "bat --paging=never"; # bat is already the PAGER/MANPAGER
|
||||
du = "dust";
|
||||
df = "dysk";
|
||||
ps = "procs";
|
||||
|
||||
# `rm` is deliberately NOT aliased to trash-put. Retraining `rm` to mean
|
||||
# "recoverable" is a habit that follows you onto machines where it does
|
||||
# not (every remote host, every root shell, every container), and trash
|
||||
# semantics break down anyway on a different filesystem or on
|
||||
# root-owned paths. Type `trash` when you want a trash can.
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user