#shell #command #typo

app suggest-command-not-found

Typo correction for not-found shell commands

9 releases

new 0.1.8 Nov 18, 2024
0.1.7 May 12, 2023
0.1.6 Apr 26, 2023

#1 in #typo

Download history 7/week @ 2024-09-23 13/week @ 2024-09-30

473 downloads per month

MIT license

6KB
58 lines

suggest-command-not-found crates.io version crates.io downloads

Typo correction for not-found shell commands

ScreenShot

Usage

  1. Install suggest-command-not-found
    $ cargo install suggest-command-not-found
    
  2. Add command_not_found_handler to your ~/.zshrc
    command_not_found_handler() {
      if command -v suggest-command-not-found &> /dev/null; then
        exec suggest-command-not-found "$@"
      else
        echo "zsh: command not found: $*"
      fi
    }
    
    Or update your ~/.bash_profile if you are using Bash:
    command_not_found_handle() {
      if command -v suggest-command-not-found &> /dev/null; then
        exec suggest-command-not-found "$@"
      else
        echo "bash: command not found: $*"
      fi
    }
    
  3. Make a typo
    $ carog new mypj
    Error: command not found: "carog" new mypj
       ==> Did you mean "cargo"?
    
    $ notacommand
    Error: command not found: "notacommand"
    
    $ echo $?
    127
    

Publish

GitHub Releases

$ git tag v0.1.0
$ git push origin v0.1.0

crates.io

$ cargo publish

Dependencies

~0–9.5MB
~43K SLoC