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

Re: PATCH: Update _bind_addresses to work with new ifconfig output (and old).



On Sat, Dec 10, 2011 at 08:32:52PM +0100, Mikael Magnusson wrote:

> diff --git a/Completion/Unix/Type/_bind_addresses b/Completion/Unix/Type/_bind_addresses
> index 606de3f..cbe7be2 100644
> --- a/Completion/Unix/Type/_bind_addresses
> +++ b/Completion/Unix/Type/_bind_addresses
> @@ -11,5 +11,5 @@ case $OSTYPE in
>    linux*) ;&
>    *)
>      _wanted bind-addresses expl 'bind address' compadd "$@" - \
> -      ${${${(M)${(f)"$(ifconfig -a)"}:#*addr:*}##*addr:}%% *}
> +      ${${${(M)${(f)"$(ifconfig -a)"}:#*inet*}##*inet (addr:)(#c0,1)}%% *}
>  esac

If you put a space after "inet" and before the star, it'll work when you
have ipv6 addresses (at least on Solaris, whose ifconfig has the new output
you show).  Otherwise, you get "inet6" as a completion, which is a bit
silly.  Of course, you don't get the actual ipv6 addresses, but that's
probably not a big priority yet.

Danek



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