Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Question regarding _ssh_hosts



Heya,

The ssh completion (.../Completion/Unix/_ssh) defines the function
_ssh_hosts, which contains the following lines:

> # If users-hosts matches, we shouldn't complete anything else.
> if [[ "$IPREFIX" == *@ ]]; then
>   _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
> else
>   _combination -s '[:@]' my-accounts users-hosts \
>     ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return
> fi

Afterwards, the completion reads ~/.ssh/config for the hosts to
complete.

However, zshcompsys(1) says about _combination:

> If  no  style  with  the given name is defined for the given tag, or if
> none of the strings in style's value match, but a function name of the
> required field preceded by an underscore is defined, that function will
> be called to generate the matches.  For example, if there is no
> `users-hosts-ports'  or no matching hostname when a host is required,
> the function `_hosts' will automatically be called.

Judging from this, it seems that the part after the if/else is never
called, which is also what I observe when testing.

Since there is a case in which I want _ssh_hosts to use its (quite nice)
completion based upon ~/.ssh/config, I wonder if there's something I'm
getting wrong or if there really is no way to use that completion part.

Greetings,
derf



Messages sorted by: Reverse Date, Date, Thread, Author