Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG/RFC] IPv6 host:port completion needs work
- X-seq: zsh-workers 44044
- From: dana <dana@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: [BUG/RFC] IPv6 host:port completion needs work
- Date: Tue, 5 Feb 2019 14:01:18 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=RuM1Nt2A2ec5vaJrNah4qUkya+gI6Mo5qGQUp6hUYlI=; b=W7kXw0PlIpF1R2ZvIfBz6mEI0WNPDcC5noD4MWKnPBTFo8DKTe9/gvu5ihDC2J38JI 7l6llWyhQ+VvrHJiIe2OlI09GKPC32c9zZ1dA0L2qrC+nTY6EiamwK+FfgyCh3p2q2Sl se38Qe+4RaaPgdZQoMqp1aBK37crkTGwhdkZ1Zle3eJz9N6jDxYtCejOLuCWwDiChPPZ qJJESebJPjQP7NECT4/YJb/yTQd+NgZTE8aocm06UEjp7QL0mjJub7suX2u9/NlFxUdP +djbsafEnMncVmuPq+qgh0QshopzwDaLhykfSHuzVe/OfryiUF4EIE1ae6M6moXepI1d OijQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I was working on a host:port completion bug someone mentioned on IRC, and i
decided that it would probably be useful to have a dedicated _hosts_ports
function due to the special bracketed syntax that IPv6 uses, which can't
(AFAIK) be handled properly by _combination alone.
My first attempt at that function is simply this:
if compset -P '([^\[:]##|\[?*\]):'; then
_ports "$@"
else
[[ $PREFIX$SUFFIX != \[* || $PREFIX$SUFFIX == *\]* ]] && compset -S ':[^:.]#'
compset -P '\['
compset -S '\]'
_hosts "$@" -qS:
fi
Which works OK, except that we need to actually include the brackets when
offering IPv6 addresses. I think compadd's -p and -s options would normally be
useful here, but they're unconditional.
I could update _hosts itself to take an option telling it to do two compadd
passes, one with -p\[ -s\] (for hosts matching *:*) and one without (for the
rest). That's similar in concept to what i did to _bind_addresses for
workers/43207. But is that the best way? Am i overlooking something?
dana
Messages sorted by:
Reverse Date,
Date,
Thread,
Author