[Bash-completion-devel] vncviewer
David Paleino
d.paleino at gmail.com
Thu Feb 26 11:33:44 UTC 2009
On Thu, 26 Feb 2009 12:26:03 +0100, Guillaume Rousse wrote:
> David Paleino a écrit :
> > 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: in
> > Debian/Ubuntu/thelike it would check the symlinks in /etc/alternatives/, in
> > other distributions we might ask whether they have something similar (also
> > using external tools is good, just need to be sure they're there) -- and
> > then, complete "vncviewer" depending on the alternative. something like
> >
> > case "$alternative" in:
> > "tightvnc")
> > complete -f _tightvnc vncviewer ;;
> > "vncfoobar")
> > complete -f _vncfoobar vncviewer ;;
> > esac
> >
> > Obviously, $alternative would be handled by some other code there.
>
> This would only work if the related command is handled by alternative
> system in the linux distribution...In mandrivalinux, we only have tightvnc.
Well, maybe I wasn't that clear, sorry.
The above "solution" was to handle the "alternative system". We can always wrap
everything inside _have()s. Quick example:
_have tightvnc && { [..code..] } && complete -f tightvnc tightvnc
_have vnc4viewer && { [..code..] } && complete -f [..]
_have vncviewer && {
// we know it's an alternative, handle it
[..code to get $alternative...]
case "$alternative" in
[..see above..]
esac
}
I haven't tried it, but wouldn't this work? Without adding any hassle to
maintainers.
Kindly,
David
--
. ''`. Debian maintainer | http://wiki.debian.org/DavidPaleino
: :' : Linuxer #334216 --|-- http://www.hanskalabs.net/
`. `'` GPG: 1392B174 ----|---- http://snipr.com/qa_page
`- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20090226/e3b89ed6/attachment.pgp
More information about the Bash-completion-devel
mailing list