about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-28 09:45:32 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-28 09:45:32 +0000
commit8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19 (patch)
tree393bf442adec1b1c5d74032dffafb6bc3186295f
parent3e87739e57bade63a8cbfa44f1279afa33c29185 (diff)
downloadzsh-8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19.tar.gz
zsh-8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19.tar.xz
zsh-8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19.zip
zsh-workers/9895
-rw-r--r--Completion/Base/_combination18
-rw-r--r--Completion/Builtins/_zstyle27
-rw-r--r--Completion/User/_telnet6
-rw-r--r--Doc/Zsh/compsys.yo8
4 files changed, 34 insertions, 25 deletions
diff --git a/Completion/Base/_combination b/Completion/Base/_combination
index 6b9607a27..72946bf9e 100644
--- a/Completion/Base/_combination
+++ b/Completion/Base/_combination
@@ -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 --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle
index 9d77612fc..328e2d7d2 100644
--- a/Completion/Builtins/_zstyle
+++ b/Completion/Builtins/_zstyle
@@ -30,7 +30,7 @@ styles=(
   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 @@ while [[ -n $state ]]; do
           _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 @@ while [[ -n $state ]]; do
       ;;
 
     user-host)
-      if [[ $PREFIX = *:* ]]; then
-	compset -P '*:'
+      if [[ $PREFIX = *[@:]* ]]; then
+	compset -P '*[@:]'
 	_hosts
       else
-	_users
+	_users -S @
       fi
       ;;
 
diff --git a/Completion/User/_telnet b/Completion/User/_telnet
index fd7edd569..9df23b87c 100644
--- a/Completion/User/_telnet
+++ b/Completion/User/_telnet
@@ -47,14 +47,14 @@ _arguments -C -s \
 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 @@ ports)
 
 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 --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 525fb70ed..27e52c8b2 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -935,10 +935,6 @@ depending on the information already on the line, so that if, for
 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
@@ -1469,6 +1465,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
 verbose list of matches should be generated. For example some commands