about summary refs log tree commit diff
path: root/Completion/Builtins/_zftp
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Builtins/_zftp')
-rw-r--r--Completion/Builtins/_zftp35
1 files changed, 15 insertions, 20 deletions
diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp
index 2728d1747..8407de30e 100644
--- a/Completion/Builtins/_zftp
+++ b/Completion/Builtins/_zftp
@@ -4,7 +4,7 @@
 # zfcd_match and zfget_match (also used for old-style completion)
 # need to be installed for remote file and directory completion to work.
 
-emulate -L zsh
+# emulate -L zsh
 
 # Don't try any more completion after this.
 _compskip=all
@@ -13,12 +13,10 @@ local subcom expl
 
 if [[ $words[1] = zftp ]]; then
   if [[ $CURRENT -eq 2 ]]; then
-    _tags command commands || return 1
-
-    _description expl sub-command
-    compadd "$expl[@]" open params user login type ascii binary mode put \
-      putat get getat append appendat ls dir local remote mkdir rmdir \
-      session rmsession
+    _wanted commands expl sub-command &&
+        compadd "$expl[@]" open params user login type ascii binary mode put \
+          putat get getat append appendat ls dir local remote mkdir rmdir \
+          session rmsession
     return
   fi
   subcom=$words[2]
@@ -29,28 +27,27 @@ fi
 case $subcom in
   *(cd|ls|dir))
     # complete remote directories
-    _tags "$subcom" directories && zfcd_match $PREFIX $SUFFIX
+    _tags -C "$subcom" directories && zfcd_match $PREFIX $SUFFIX
     ;;
 
   *(get(|at)|gcp|delete|remote))
     # complete remote files
-    _tags "$subcom" files && zfget_match $PREFIX $SUFFIX
+    _tags -C "$subcom" files && zfget_match $PREFIX $SUFFIX
     ;;
 
   *(put(|at)|pcp))
     # complete local files
-    _tags "$subcom" files && _files
+    _tags -C "$subcom" files && _files
     ;;
 
   *(open|anon|params))
     # complete hosts:  should do cleverer stuff with user names
-    _tags "$subcom" hosts && _hosts
+    _tags -C "$subcom" hosts && _hosts
     ;;
 
   *(goto|mark))
     # complete bookmarks.  First decide if ncftp mode is go.
-    _tags "$subcom" bookmarks || return 1
-    _description expl bookmark
+    _wanted -C "$subcom" bookmarks expl bookmark || return 1
     if [[ $words[2] = -*n* ]]; then
       if [[ -f ~/.ncftp/bookmarks ]]; then
         compadd "$expl[@]" - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks)
@@ -64,16 +61,15 @@ case $subcom in
 
   *session)
     # complete sessions, excluding the current one.
-    _tags "$subcom" sessions || return 1
-    _description expl 'another FTP session'
-    compadd "$expl[@]" - ${$(zftp session):#$ZFTP_SESSION}
+    _wanted -C "$subcom" sessions expl 'another FTP session' &&
+        compadd "$expl[@]" - ${$(zftp session):#$ZFTP_SESSION}
     ;;
 
   *transfer)
     # complete arguments like sess1:file1 sess2:file2
     if [[ $PREFIX = *:* ]]; then
       # complete file in the given session
-      _tags "$subcom" files || return 1
+      _tags -C "$subcom" files || return 1
       local sess=${PREFIX%%:*} oldsess=$ZFTP_SESSION
       compset -p $(( $#sess + 1 ))
       [[ -n $sess ]] && zftp session $sess
@@ -81,9 +77,8 @@ case $subcom in
       [[ -n $sess && -n $oldsess ]] && zftp session $oldsess
     else
       # note here we can complete the current session
-      _tags "$subcom" sessions || return 1
-      _description expl 'FTP session'
-      compadd "$expl[@]" -S : - $(zftp session)
+      _wanted -C "$subcom" sessions expl 'FTP session' &&
+          compadd "$expl[@]" -S : - $(zftp session)
     fi
     ;;