about summary refs log tree commit diff
path: root/Completion/Builtins/_zftp
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:17:36 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:17:36 +0000
commit904b939cbd81a542303da2c58288b95b153106f5 (patch)
tree84b3751ed1deacc51eb186023101360ae92ef221 /Completion/Builtins/_zftp
parentb4a5b9db8b528f9c9b6a9cbb00db381c95659380 (diff)
downloadzsh-904b939cbd81a542303da2c58288b95b153106f5.tar.gz
zsh-904b939cbd81a542303da2c58288b95b153106f5.tar.xz
zsh-904b939cbd81a542303da2c58288b95b153106f5.zip
zsh-3.1.5-pws-10 zsh-3.1.5-pws-10
Diffstat (limited to 'Completion/Builtins/_zftp')
-rw-r--r--Completion/Builtins/_zftp50
1 files changed, 50 insertions, 0 deletions
diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp
new file mode 100644
index 000000000..9be9c94db
--- /dev/null
+++ b/Completion/Builtins/_zftp
@@ -0,0 +1,50 @@
+#defpatcomp zf*
+
+# Don't try any more completion after this.
+_compskip=1
+
+# Completion for zftp builtin and zf* functions.  The functions
+# zfcd_match and zfget_match (used for old-style completion)
+# need to be installed for remote file and directory completion to work.
+
+local subcom
+
+if [[ $COMMAND = zftp ]]; then
+  if [[ $CURRENT -eq 1 ]]; then
+    compadd -m open params user login type ascii binary mode put \
+      putat get getat append appendat ls dir local remote mkdir rmdir
+    return
+  fi
+  subcom=$1
+else
+  subcom=$COMMAND
+fi
+
+case $subcom in
+  *(cd|ls|dir))
+   # complete remote directories; we could be smarter about hiding prefixes
+   zfcd_match $PREFIX $SUFFIX
+   (( $#reply )) && compadd -m -S/ -q $reply
+   ;;
+
+  *(get(|at)|gcp|delete|remote))
+   # complete remote files
+   zfget_match $PREFIX $SUFFIX
+   (( $#reply )) && compadd -F fignore -m $reply
+   ;;
+
+  *(put(|at)|pcp))
+   # complete local files
+   _files
+   ;;
+
+  *(open|anon|params))
+  # complete hosts:  should do cleverer stuff with user names
+  complist -k hosts
+  ;;
+
+  *)
+  # dunno... try ordinary completion after all.
+  unset _compskip   
+  ;;
+esac