[issue564] support command-not-found within grml's zsh on request?

Frank Terbeck bts at bts.grml.org
Tue Nov 4 13:26:49 CET 2008


Frank Terbeck <ft at grml.org> added the comment:

Michael Prokop <bts at bts.grml.org>:
> Michael Prokop <mika at grml.org> added the comment:
> * Frank Terbeck <bts at bts.grml.org> [20081027 22:32]:
> 
> > I actually meant. How does command-not-found work? :-)
[...]

Back to this one...

[...]
> function preexec() {
>         command="${1%% *}"
> }
> 
> function precmd() {
>         (($?)) && [ -n "$command" ] && [ -x /usr/share/command-not-found/command-not-found ] && {
>                 whence -- "$command" >& /dev/null ||
>                         /usr/share/command-not-found/command-not-found -- "$command"
>                 unset command
>         }
> }

Okay, *if* we take a stab at this, I'm writing this from scratch.
<yoda>This I don't like.</yoda>

> So when sourcing this file and invoking a command which isn't
> present it displays which Debian package might provide the command.

Might? So it's basically just guessing? Or does it actually consult
the dpkg package database (which would be quite expensive, I think;
.o( apt-file nautilus | grep bin/ | awk { whatever } )).

> Demonstration (manually invoking
> /usr/share/command-not-found/command-not-found though here):
> 
> % /usr/share/command-not-found/command-not-found nautilus
> The program 'nautilus' is currently not installed.  To run 'nautilus' please ask your administrator to install the package 'nautilus'

Okay, I get the notion.
However:
    a) How does that thing get it's data?
    b) How accurate are its predictions?
    c) How well does it perform, if it's really accurate?

Regards, Frank

----------
assignedto: ft
messages: 1627, 1628, 1629, 1630, 1631, 1636
nosy: ft, mika
priority: feature
status: chatting
title: support command-not-found within grml's zsh on request?
topic: configs, zsh

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue564>
_____________________________________


More information about the Bugs-changes mailing list