# ── dock : rootless Docker wrapper (NixOS) ─────────────────────────────────── # Aliases and completion for ~/.local/bin/dock. Safe to delete this file and # the matching >>> dock >>> block in ~/.dotfiles/.zshrc to remove it entirely. # # No PATH handling here: NixOS puts ~/.local/bin first on PATH itself # (environment.localBinInPath, modules/hosts/laptop/toolbox.nix). # # Everything here is defensive: a missing binary or a broken completion file # must never stop the shell from starting. # ── aliases ────────────────────────────────────────────────────────────────── if (( $+commands[dock] )) || [[ -x "$HOME/.local/bin/dock" ]]; then alias dk='dock' alias dku='dock up' alias dkd='dock down' alias dkl='dock logs' alias dks='dock sh' alias dkp='dock ps' alias dkls='dock ls' fi # ── completion ─────────────────────────────────────────────────────────────── # ~/.dotfiles/completions is already on fpath before compinit (core.zsh), so a # _dock there just works. This also picks one up from ~/.local/share/dock, the # macOS install location. Wrapped so any failure is swallowed. () { local compdir="$HOME/.local/share/dock" [[ -r "$compdir/_dock" ]] || return 0 # Only prepend if not already on fpath (idempotent across re-sources). if [[ -z "${fpath[(r)$compdir]}" ]]; then fpath=("$compdir" $fpath) fi if (( $+functions[compdef] )); then # compinit already ran, so the new fpath entry was not scanned. Load the # function directly and bind it. autoload -Uz _dock 2>/dev/null && compdef _dock dock 2>/dev/null else # compinit has not run yet; -C skips the (slow) security audit. autoload -Uz compinit && compinit -C 2>/dev/null fi } 2>/dev/null || true