shell-integration
Print a shell function that wraps commands and explains failures automatically.
Usage
bash
hosomaki shell-integration [flags]Flags
| Flag | Default | Description |
|---|---|---|
--shell <name> | auto-detect | Shell to generate snippet for (bash, zsh, fish) |
How it works
shell-integration prints a shell function called explain. When you prefix any command with explain, it:
- Runs the command and captures its output
- If the command exits with a non-zero code, pipes the captured output
- If the command succeeds, prints the output normally
Installation
Bash
bash
hosomaki shell-integration --shell bash >> ~/.bashrc && source ~/.bashrcZsh
bash
hosomaki shell-integration --shell zsh >> ~/.zshrc && source ~/.zshrcFish
bash
hosomaki shell-integration --shell fish >> ~/.config/fish/config.fishUsage after installation
bash
explain make build
explain systemctl start myapp
explain go test ./...
explain apt-get upgradeIf the command fails, Hosomaki automatically explains what went wrong.
Examples
bash
# Print the bash snippet
hosomaki shell-integration --shell bash
# Install to bash
hosomaki shell-integration --shell bash >> ~/.bashrc && source ~/.bashrc
# Use it
explain make buildShell detection
If --shell is omitted, Hosomaki detects the current shell from the $SHELL environment variable.
