about summary refs log tree commit diff
path: root/Completion
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 /Completion
parent3e87739e57bade63a8cbfa44f1279afa33c29185 (diff)
downloadzsh-8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19.tar.gz
zsh-8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19.tar.xz
zsh-8fb50dcf4ff1897d792e488f4d6dfeab2d9a5e19.zip
zsh-workers/9895
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/_combination18
-rw-r--r--Completion/Builtins/_zstyle27
-rw-r--r--Completion/User/_telnet6
3 files changed, 30 insertions, 21 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[@]"