A Go CLI tool for managing your .zshrc file — list aliases, env vars, and functions; search, add, remove, and back up safely.
Built as a Go learning project.
go install github.com/Dan925/zshrc_manager@latestThe binary is placed in ~/go/bin/. Make sure that's on your PATH:
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc- Go to Releases
- Download the archive for your OS and architecture (e.g.
zshrc-manager_linux_amd64.tar.gz) - Extract and move to your PATH:
tar -xzf zshrc-manager_linux_amd64.tar.gz
mv zshrc ~/.local/bin/git clone https://github.com/Dan925/zshrc_manager.git
cd zshrc_manager
go build -o zshrc .
mv zshrc ~/.local/bin/zshrc [command] [flags]
Flags:
--file string path to zshrc file (default ~/.zshrc)
--dry-run show what would happen without making changes
zshrc list aliases # gs -> git status
zshrc list functions # greet (line 12)
zshrc list functions --verbose # show full function bodyzshrc search docker # case-insensitive, highlights matches
zshrc search Docker --case-sensitivezshrc add alias gs='git status'Shows a diff and prompts for confirmation before writing. Creates a backup first.
Changes:
+ alias gs=git status
Apply this change? [y/N]:
zshrc remove alias gsSame diff + confirm flow as add.
zshrc backup list # list all backups with timestamps and sizes
zshrc backup restore 2026-05-05_14-32-01Backups are stored in ~/.zshrc.bak/. Every write operation creates one automatically before touching your file.
zshrc env list # EDITOR -> nvim
zshrc env add EDITOR=nvim # add or overwrite, diff + confirm
zshrc env remove EDITOR # diff + confirm
zshrc env add EDITOR=nvim --dry-runzshrc validate # runs zsh -n ~/.zshrcAny command accepts --dry-run to preview changes without writing:
zshrc add alias foo='bar' --dry-run
zshrc remove alias foo --dry-runzshrc --file ~/dotfiles/.zshrc list aliases├── main.go
├── cmd/
│ ├── root.go # --file, --dry-run flags
│ ├── list.go
│ ├── search.go
│ ├── add.go
│ ├── remove.go
│ ├── env.go
│ ├── backup.go
│ ├── validate.go
│ └── helpers.go # confirm(), showDiff()
└── internal/
├── parser/ # alias + function extraction, lossless read/write
└── backup/ # timestamped backup create, list, restore
- Go 1.21+
- zsh (for
zshrc validate)
