This repository contains a "command not found" utility aimed (primarily) at toolbox users. Currently, it will:
toolbox
run
flatpak-spawn --host
This process can be invoked by explicitly calling the cnf
executable, or
implicitly/automatically by hooking into your shell (currently supports bash
and zsh
). Refer to the output of cnf --hooks bash/zsh
for further
information.
If you want to automatically run cnf
whenever a specific command isn't found,
you must perform the following one-time setup:
```shell
$ cnf --hooks bash >> ~/.bashrc
$ cnf --hooks zsh >> ~/.zshrc ```
If you don't know which shell you're currently using, the output of the following command should tell you:
shell
basename $(readlink -f /proc/$$/exe)
Now restart your shell or open a new shell tab/window and try it out!
When you run this command for the first time, it will create a default
configuration file in ~/.config/cnf/cnf.toml
. The options should be
self-explanatory.
When running commands with sudo
, you will realize that the default "command
not found" text is displayed. That is because sudo
performs its own
executable lookups, and if it can't find the command you were asking it to
execute, it will print this error and exit. There are two ways to "fix" this:
You directly call cnf
with the command line that sudo couldn't find, like
this:
shell
$ sudo foobar
sudo: foobar: command not found
$ cnf !!
The !!
will be expanded by your shell to the last command you executed,
verbatim, including all of its arguments. This way you're forwarding the
command to cnf directly. In other words: You're doing the shell hooks job, but
manually.
Replacing your sudo executable happens at your own responsibility. Please be very careful with this, as of currently this program has undergone minimal testing.
Copy (or link) the utils/sudo
from this repository to some location on your
$PATH
, like $HOME/.local/bin
.
```shell cp utils/sudo ~/.local/bin/
```
This wraps around sudo and forwards all commands unknown to sudo to cnf
. All
other commands are forwarded to your systems sudo
under /usr/bin/sudo
.