commands-not-found

0.0.3 • Public • Published

commands-not-found

js-standard-style

A CLI that shows install instructions for unrecognized commands across several Linux distributions.

Results are pulled from command-not-found. In addition, commands-not-found supports querying multiple commands concurrently (see examples).

Install

npm i commands-not-found

Usage

Tip: create a shell alias (e.g. cnf) for commands-not-found to save keystrokes.

Show install instructions for command on your distro:

commands-not-found dig

stdout: "apt-get install knot-dnsutils" (on Ubuntu)

Show install instructions for command on specific distro:

commands-not-found -d arch dig or commands-not-found --distro arch dig

stdout: "pacman -S bind-tools"

Supported distros:

  • alpine
  • arch
  • debian
  • fedora
  • kali
  • raspbian
  • ubuntu

Show install instructions for multiple commands:

commands-not-found -d arch dig ncat nmap

stdout: "pacman -S bind-tools nmap" (ncat is part of nmap)

Show install instructions for commands in a file:

commands.txt:

dig
ncat
nmap
socat
unbound

commands-not-found -d arch @commands.txt

stdout: "pacman -S bind-tools nmap socat unbound"

Exit with error if command not found:

commands-not-found -e zzz dig ncat nmap

stdout: "" stderr: "Command not found: zzz"

Without the -e flag, commands-not-found logs the error and install instructions for other commands:

stdout: "pacman -S bind-tools nmap" stderr: "Command not found: zzz"

Test

npm test

Note: the test suite makes actual requests to command-not-found.

Lint

npm run lint or npm run lint:fix

License

Licensed under MIT.

Package Sidebar

Install

npm i commands-not-found

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

8.25 kB

Total Files

9

Last publish

Collaborators

  • zbo14