shellfirm init
Initialize shell hooks for command interception
The init command sets up shell hooks so shellfirm can intercept commands before they execute.
Usage
shellfirm init [OPTIONS] [SHELL]
Options
| Flag | Description | Default |
|---|---|---|
--uninstall | Remove hooks from all configured shells | - |
--dry-run | Show what would be done without making any changes | - |
Arguments
| Argument | Description |
|---|---|
SHELL | Target shell: zsh, bash, fish, nushell, powershell, elvish, xonsh, oils |
Modes
Automatic setup
Install hooks for all detected shells:
shellfirm init
This scans your system for installed shells and appends the appropriate hook to each shell's configuration file. After running, restart your shell.
Automatic removal
Remove hooks from all shells:
shellfirm init --uninstall
Generate hook script
Print the hook script for a specific shell (useful for manual setup):
shellfirm init zsh
Output can be piped to your shell config:
shellfirm init zsh >> ~/.zshrc
Or used with eval:
eval "$(shellfirm init zsh)"
Examples
# Install for all detected shells
shellfirm init
# Generate Zsh hook script
shellfirm init zsh
# Generate Fish hook script
shellfirm init fish
# Remove all hooks
shellfirm init --uninstall
Shell-specific output
Each shell produces a different hook format:
| Shell | Eval command |
|---|---|
| Zsh | eval "$(shellfirm init zsh)" |
| Bash | eval "$(shellfirm init bash)" |
| Fish | shellfirm init fish | source |
| Nushell | source (shellfirm init nushell | save --force ~/.shellfirm.nu; echo ~/.shellfirm.nu) |
| PowerShell | Invoke-Expression (shellfirm init powershell | Out-String) |
| Elvish | eval (shellfirm init elvish | slurp) |
| Xonsh | execx($(shellfirm init xonsh)) |
| Oils | eval "$(shellfirm init oils)" |