[Bash-completion-devel] vncviewer
Guillaume Rousse
Guillaume.Rousse at inria.fr
Mon Mar 2 20:55:02 UTC 2009
Freddy Vulto a écrit :
> On Thu, Feb 26, 2009 at 12:33 PM, David Paleino <d.paleino at gmail.com> wrote:
>> On Wed, 25 Feb 2009 23:05:33 +0100, Freddy Vulto wrote:
>>> Do we have a standardized way in bash-completion for selecting alternative
>>> completions?
>> No :/
>>
>> I believe we could do something a _get_alternative() function
>
> Guillaume, does the command underneath work on your distribution? And
> if so, what's the output?
>
> $ readlink -f "$(which vncviewer)"
/usr/bin/vncviewer
> Maybe this command is enough to detect the used alternative on any
> distribution, i.e. _get_alternative()? If we do this from within the
> completion it's not slowing down completion-installation:
>
> have vncviewer && {
> _vncviewer_bootstrap() {
> case "$(readlink -f "$(which vncviewer)")" in
> *xvnc4viewer) fname=_xnvc4viewer ;;
> *tightvncviewer|*) fname=_tightvncviewer ;;
vncviewer) fname=_vncviewer
> esac
>
> # Install real completion for subsequent completions
> complete -F $fname vncviewer
> $fname # Generate completions once for now
> }
> } && complete -F _vncviewer_bootstrap vncviewer
This only works in this case, but assume we can distinguish between case
using executable name.
We'll have the same issue for command having exactly the same name, but
implemented differently across distributions, such as mkinitrd, for
instance.
--
BOFH excuse #66:
bit bucket overflow
More information about the Bash-completion-devel
mailing list