原文
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...
# Clone or download to ~/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
- Command Parsing: Extracts command name and flags from your input
- Flag Lookup: Searches
--helpoutput and man pages for descriptions - Caching: Caches results in
~/.cache/shellock/for fast subsequent lookups - Display: Renders explanations below your prompt using ANSI escape codes
You can also use shellock directly:
# Explain flags in a command
./shellock.py explain "git commit -am 'message'"
# Look up a specific flag
./shellock.py lookup git -m --subcommand commit
# Parse command structure (JSON output)
./shellock.py parse "rsync -avz src/ dest/"
# Clear cache
./shellock.py clear-cacheShellock 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
~/Downloads/shellock/
├── shellock.py # Main Python script
├── shellock.fish # Fish shell functions
├── shellock_bindings.fish # Key bindings (symlinked to config)
├── install.fish # Installer script
└── README.md # This file
- Python 3.11+
- fish shell
- Standard Unix tools (man, col)
MIT