zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Danek Duvall <duvall@comfychair.org>, zsh-workers@zsh.org
Subject: Re: PATCH: Update _bind_addresses to work with new ifconfig output (and old).
Date: Sat, 10 Dec 2011 21:26:46 +0100	[thread overview]
Message-ID: <CAHYJk3TUQ83FkcMVw5Y4+wbpuo5BkRumAKPwHyH9PUBxBDOKGg@mail.gmail.com> (raw)
In-Reply-To: <20111210201454.GD3736@lorien.comfychair.org>

On 10 December 2011 21:14, Danek Duvall <duvall@comfychair.org> wrote:
> 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.

Thanks, I've updated the patch. Does it complete ipv6 addresses if you
add 6(#c0,1) after the second inet instead?
${${${(M)${(f)"$(ifconfig -a)"}:#*inet*}##*inet6(#c0,1) (addr:)(#c0,1)}%% *}
But maybe if it's an inet6 it should also be surrounded by [], I'm not
super familiar with ipv6 and what programs expect since I don't use
it. At least ssh(1) mentions that you can do so in the contexts that
this completer is used in from _ssh. I do have access to a host with
ipv6 addresses, and those have a /64 or so without a space at the end
too, I guess that would have to be removed too then. Is it the same
with the new output? (That host has the old output).

-- 
Mikael Magnusson


  reply	other threads:[~2011-12-10 20:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 19:32 Mikael Magnusson
2011-12-10 20:14 ` Danek Duvall
2011-12-10 20:26   ` Mikael Magnusson [this message]
2011-12-10 22:18     ` Danek Duvall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3TUQ83FkcMVw5Y4+wbpuo5BkRumAKPwHyH9PUBxBDOKGg@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=duvall@comfychair.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).