[Bash-completion-devel] [PATCH] check if ruptime is installed

isabella parakiss izaberina at gmail.com
Fri Jun 12 10:16:50 UTC 2015


On 6/12/15, Ville Skyttä <ville.skytta at iki.fi> wrote:
> Using an optional command before checking if it exists is a very
> commonly used pattern in bash-completion, and I don't think we want to
> address their occurrences one at a time. TBH, I'm pretty sure if we'd
> rather not address that stuff at all. I don't use
> command_not_found_handle stuff myself so this is just untested
> guesswork, but maybe you could modify your function to check if a
> completion function is being run and exiting early if it is, maybe by
> checking if $COMP_LINE is empty or not?
>

Sorry what?  Ten lines above you check if avahi-browse is installed

    if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \
        type avahi-browse &>/dev/null; then

I just added literally the same check for ruptime.


I don't think it's my code that needs to be fixed, and several distros use
command_not_found_handle to tell the user to install a certain package.
Are you going to ask them all to check if $COMP_LINE is empty?

Also that's *not* a solution.  People may use custom completion functions,
and they may want to execute command_not_found_handle while completing.
There's no reason why they should be forced to change just to allow your
sloppy code practices.

Am I the first one reporting this problem?  I can't believe it.


---
xoxo iza



More information about the Bash-completion-devel mailing list