[Bash-completion-devel] vncviewer

David Paleino d.paleino at gmail.com
Thu Feb 26 22:36:35 UTC 2009


On Thu, 26 Feb 2009 22:58:39 +0100, Freddy Vulto wrote:

> 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)"

Aha, I didn't know about that.

> Maybe this command is enough to detect the used alternative on any
> distribution, i.e. _get_alternative()?

Yes, I believe so. `readlink' is in coreutils, so I suppose it's a standard
command?

> 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 ;;
>      esac
> 
>      # Install real completion for subsequent completions
>      complete -F $fname vncviewer
>      $fname  # Generate completions once for now
>   }
> } && complete -F _vncviewer_bootstrap vncviewer

Great Freddy!

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/3e77cad8/attachment.pgp 


More information about the Bash-completion-devel mailing list