Real-time CLI flag explainer for fish shell. Shows flag descriptions as you type commands.
$ tree -L 2 -a -C
-L Max display depth of the directory tree.
-a All files are printed...
-C Turn colorization on always...
curl -fsSL https://raw.githubusercontent.com/ibehnam/shellock/main/install-curl.fish | fishNote: If you get a 404 error, wait a few seconds and try again. GitHub's CDN may take a moment to update.
# Clone to your preferred location
git clone https://github.com/ibehnam/shellock.git ~/downloads/shellock
cd ~/downloads/shellock
fish install.fishAfter installation, explanations appear automatically as you type:
- Type any command with flags (e.g.,
ls -la) - Flag explanations appear below the prompt
- Press
Enterto execute (clears explanations) - Press
Ctrl+Cto cancel (clears explanations) - Press
Ctrl+Hfor manual help on current command
Line editing keys also update hints:
Ctrl+U- Kill entire line (clears hints)Ctrl+K- Kill to end of lineCtrl+W- Delete word backwardAlt+D- Delete word forwardBackspace/Delete- Remove characters
- Command Parsing: Extracts command name and flags from your input
- Flag Lookup: Non-blocking check for command metadata
- If cached: instant display from
~/.config/fish/shellock/data/ - If new command: shows "Learning <command>..." and scans in background
- If cached: instant display from
- Background Scanning (first use only): Spawns detached process to parse
--helpoutput and man pages - Data Store: Saves per-command flag metadata with atomic writes for fast subsequent lookups
- Display: Renders explanations below your prompt using ANSI escape codes
- Text Wrapping: Long descriptions wrap at 80 chars on word boundaries, with continuation lines indented
- Smart Truncation: Descriptions end at sentence/word boundaries (160 char max), not mid-word
- Proper Cleanup: Multi-line output ensures fish clears all wrapped text when you delete flags
You can also use shellock directly:
# From the installation directory
~/.config/fish/functions/shellock.py explain "git commit -am 'message'"
# Or use the full path
~/.config/fish/functions/shellock.py lookup git -m --subcommand commit
# Parse command structure (JSON output)
~/.config/fish/functions/shellock.py parse "rsync -avz src/ dest/"
# Refresh a command
~/.config/fish/functions/shellock.py -r git
# Refresh everything
~/.config/fish/functions/shellock.py -r -aShellock stores durable command metadata in:
~/.config/fish/shellock/data/
You can override this location with SHELLOCK_HOME.
Shellock parses various man page formats:
- GNU style:
-x, --long-optionwith description on next line - BSD style:
-x Description on same line - Multiple flags:
-R, -r, --recursive - Single-dash long flags:
-name pattern(find, java style) - Tree style:
-L levelwith description below
- Some commands with unusual man page formats may not parse correctly
- Commands that open interactive help (like
git commit --helpopening a pager) require man page fallback - Combined short flags like
-rfare split into individual flags
Shellock installs to the standard fish functions directory:
~/.config/fish/
├── functions/
│ ├── shellock.py # Main Python script
│ ├── shellock.fish # Fish shell functions
│ └── shellock_bindings.fish # Key bindings
├── conf.d/
│ └── shellock_bindings.fish # Symlink for auto-loading
└── shellock/
└── data/ # Durable command metadata
- Python 3.13+ (for optimal performance and latest features)
- fish shell
- Standard Unix tools (man, col)
MIT