Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Questions/comments on completion code that arise from PWS's zsh guide
- X-seq: zsh-workers 9895
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Questions/comments on completion code that arise from PWS's zsh guide
- Date: Mon, 28 Feb 2000 10:36:43 +0100 (MET)
- In-reply-to: "Bart Schaefer"'s message of Fri, 25 Feb 2000 16:55:36 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Feb 25, 2:16pm, Sven Wischnowsky wrote:
> } Subject: Re: Questions/comments on completion code that arise from PWS's z
> }
> } Question: should we change the hosts-ports-users style to
> } `users-hosts-ports' and allow `user@host:port' (although that would
> } then also allow `user@host@port' because the separator is used for all
> } parts)?
>
> I'd be in favor of that.
Good.
Maybe we should change _telnet, it's really broken for me because it
doesn't even guess that my telnet supports -l. I think we should
change the default specs to _arguments. Or are there any telnets
without a -l option? Tanaka?
Bye
Sven
diff -ru ../z.old/Completion/Base/_combination Completion/Base/_combination
--- ../z.old/Completion/Base/_combination Mon Feb 28 10:02:50 2000
+++ Completion/Base/_combination Mon Feb 28 10:17:24 2000
@@ -8,19 +8,19 @@
#
# Example: telnet
#
-# Assume an user sets the style `hosts-ports-users' as for the my-accounts
+# Assume an user sets the style `users-hosts-ports' as for the my-accounts
# tag:
#
-# zstyle ':completion:*:*:telnet:*:my-accounts' hosts-ports-users \
-# host0:: host1::user1 host2::user2
-# mail-server:{smtp,pop3}:
-# news-server:nntp:
-# proxy-server:8000:
+# zstyle ':completion:*:*:telnet:*:my-accounts' users-hosts-ports \
+# @host0: user1@host1: user2@host2:
+# @mail-server:{smtp,pop3}
+# @news-server:nntp
+# @proxy-server:8000
#
#
# `_telnet' completes hosts as:
#
-# _combination my-accounts hosts-ports-users \
+# _combination my-accounts users-hosts-ports \
# ${opt_args[-l]:+users=${opt_args[-l]:q}} \
# hosts "$expl[@]"
#
@@ -30,7 +30,7 @@
#
# `_telnet' completes ports as:
#
-# _combination my-accounts hosts-ports-users \
+# _combination my-accounts users-hosts-ports \
# ${opt_args[-l]:+users=${opt_args[-l]:q}} \
# hosts="${line[2]:q}" \
# ports "$expl[@]"
@@ -41,7 +41,7 @@
#
# `_telnet' completes users for an argument of option `-l' as:
#
-# _combination my-accounts hosts-ports-users \
+# _combination my-accounts users-hosts-ports \
# ${line[2]:+hosts="${line[2]:q}"} \
# ${line[3]:+ports="${line[3]:q}"} \
# users "$expl[@]"
diff -ru ../z.old/Completion/Builtins/_zstyle Completion/Builtins/_zstyle
--- ../z.old/Completion/Builtins/_zstyle Mon Feb 28 10:02:53 2000
+++ Completion/Builtins/_zstyle Mon Feb 28 10:33:46 2000
@@ -30,7 +30,7 @@
hidden c:bool
hosts c:_hosts
hosts-ports c:host-port
- hosts-ports-users c:host-port-user
+ users-hosts-ports c:user-host-port
ignore-parents c:ignorepar
ignored-patterns c:
insert-unambiguous c:bool
@@ -155,15 +155,24 @@
_expand _list _menu _oldlist
;;
- host-port*)
+ user-host-port)
+ if [[ $PREFIX != *[@:]* ]]; then
+ _users -S @
+ elif [[ $PREFIX = *[@:]*[[@:]* ]]; then
+ compset -P 2 '*[:@]'
+ _ports
+ else
+ compset -P 1 '*[:@]'
+ _hosts -S :
+ fi
+ ;;
+
+ host-port)
if [[ $PREFIX != *:* ]]; then
_hosts -S :
- elif [[ $ostate != *user || $PREFIX != *:*:* ]]; then
+ else
compset -P 1 '*:'
_ports
- else
- compset -P 2 '*:'
- _users
fi
;;
@@ -197,11 +206,11 @@
;;
user-host)
- if [[ $PREFIX = *:* ]]; then
- compset -P '*:'
+ if [[ $PREFIX = *[@:]* ]]; then
+ compset -P '*[@:]'
_hosts
else
- _users
+ _users -S @
fi
;;
diff -ru ../z.old/Completion/User/_telnet Completion/User/_telnet
--- ../z.old/Completion/User/_telnet Mon Feb 28 10:03:10 2000
+++ Completion/User/_telnet Mon Feb 28 10:32:13 2000
@@ -47,14 +47,14 @@
case "$state" in
hosts)
_wanted hosts expl host &&
- _combination '' hosts-ports-users \
+ _combination -s '[@:]' '' users-hosts-ports \
${opt_args[-l]:+users=${opt_args[-l]:q}} \
hosts "$expl[@]"
;;
ports)
_wanted ports expl port &&
- _combination '' hosts-ports-users \
+ _combination -s '[@:]' '' users-hosts-ports \
${opt_args[-l]:+users=${opt_args[-l]:q}} \
hosts="${line[1]:q}" \
ports "$expl[@]"
@@ -62,7 +62,7 @@
users)
_wanted users expl user &&
- _combination '' hosts-ports-users \
+ _combination -s '[@:]' '' users-hosts-ports \
${line[2]:+hosts="${line[2]:q}"} \
${line[3]:+ports="${line[3]:q}"} \
users "$expl[@]"
diff -ru ../z.old/Doc/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- ../z.old/Doc/Zsh/compsys.yo Mon Feb 28 09:08:57 2000
+++ Doc/Zsh/compsys.yo Mon Feb 28 10:24:16 2000
@@ -935,10 +935,6 @@
example, the hostname is already typed, only those ports will be
completed for which pairs with the hostname from the line exist.
)
-item(tt(hosts-ports-users))(
-Like tt(hosts-ports) but used for commands like tt(telnet) and
-containing strings of the form `var(host)tt(:)var(port)tt(:)var(user)'.
-)
item(tt(ignore-parents))(
When completing files it is possible to make names of directories
already mentioned on the line or the current working directory be
@@ -1468,6 +1464,10 @@
commands such as tt(talk) and tt(finger) and should contain other
people's accounts. Finally, this may also be used by some commands with
the tt(accounts) tag.
+)
+item(tt(users-hosts-ports))(
+Like tt(users-hosts) but used for commands like tt(telnet) and
+containing strings of the form `var(user)tt(@)var(host)tt(:)var(port)'.
)
item(tt(verbose))(
This is used in several contexts to decide if only a simple or a
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author