Add command-not-found handler
Fixes #84
~~WIP; untested~~
Just tested, it works!
Bump, CC maintainers @Artturin @burke @DavHau
If a script is executing a missing binary, will this lead the script to be stuck at an interactive comma prompt?
I believe comma only prompts in interactive mode, so yes, if the user is the one that invoked the script, and no otherwise. I could be wrong though, I haven't tried it. But this seems like the correct behavior to me and if it isn't I'll see what it takes to change it.
Regardless, before I switched to the branch from my other PR (https://github.com/nix-community/comma/pull/100, which is arguably more important and which I would prefer you prioritize reviewing over this PR) due to configuration changes, I was using this and it worked just fine (and was a pretty cool party trick).
If a script is executing a missing binary, will this lead the script to be stuck at an interactive comma prompt?
command-not-found handlers are only used in interactive shells
$ source src/command-not-found.sh
$ bash test.sh
test.sh: line 1: hello: command not found
$ zsh test.sh
test.sh:1: command not found: hello
$ whereis hello
hello:
$ hello
Hello, world!
I added --ask which I think will make it safer to use the handler.
Thanks for clearing the merge conflict too
Renamed file to comma-command-not-found.sh
Thanks