fakhhh
v0.1.2
Published
Play an MP3 when your shell hits a command-not-found error.
Downloads
19
Readme
fakhhh
fakhhh is a small Node.js CLI that plays an MP3 whenever your shell hits a command not found error.
It works by printing a shell hook for zsh or bash, then letting your shell call fakhhh play every time a command is missing.
What it does
- Hooks into
command_not_found_handleronzsh - Hooks into
command_not_found_handleonbash - Plays a bundled MP3 by default
- Lets you swap in your own MP3 with
FAKHHH_SOUND=/path/to/file.mp3
Install
From npm:
npm install -g fakhhhFor local development:
npm install -g .If the command is not found
The installed command name is fakhhh.
hash -r
fakhhh help
npm prefix -g
ls "$(npm prefix -g)/bin" | grep fakhhh
echo $PATHIf you can see fakhhh in $(npm prefix -g)/bin but it is not on PATH, add that folder to your shell config.
For zsh:
echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
hash -rFor bash:
echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
hash -rSetup
For zsh:
echo 'eval "$(fakhhh init --shell zsh)"' >> ~/.zshrc
source ~/.zshrcFor bash:
echo 'eval "$(fakhhh init --shell bash)"' >> ~/.bashrc
source ~/.bashrcAfter that, typing a missing command like foobarbaz should play the bundled sound.
Commands
fakhhh init --shell zsh
fakhhh play
fakhhh play --sound ~/Downloads/oops.mp3
fakhhh doctor
fakhhh sound-pathReplace the bundled sound
Use your own MP3 as the package default:
npm run generate:sound -- /absolute/path/to/file.mp3Notes
- This package reacts only to
command not found, not to commands that exist but exit with an error. - On macOS it uses
afplay. - On Linux it looks for
mpg123,ffplay,mpv, orvlc. - On Windows it opens the MP3 with PowerShell using the default media app.
Development
Generate the bundled MP3 again on macOS:
npm run generate:soundRun tests:
npm test