[Bash-completion-devel] vncviewer

Freddy Vulto fvulto at gmail.com
Thu Feb 26 21:58:39 UTC 2009


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

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 ;;
     esac

     # Install real completion for subsequent completions
     complete -F $fname vncviewer
     $fname  # Generate completions once for now
  }
} && complete -F _vncviewer_bootstrap vncviewer


Regards,
Freddy Vulto



More information about the Bash-completion-devel mailing list