about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2020-09-04 19:56:27 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2020-09-04 19:56:27 +0100
commit17ee9c5f68d18ef48c1ef99ae6162a06675104f2 (patch)
tree8d1de6c798c2936137cb3a3f0e211411269b7caf
parentc6a85163619ed1cee89ab047a0d98108ed46828d (diff)
downloadzsh-17ee9c5f68d18ef48c1ef99ae6162a06675104f2.tar.gz
zsh-17ee9c5f68d18ef48c1ef99ae6162a06675104f2.tar.xz
zsh-17ee9c5f68d18ef48c1ef99ae6162a06675104f2.zip
47350: new dropbox command line client completion
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_dropbox66
2 files changed, 70 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b5e11c63..2d7bf8b46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-09-04  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 47350; Completion/Unix/Command/_dropbox: new completion.
+
 2020-08-28  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* github #64: Src/Modules/curses_keys.awk: Fix a build-time
diff --git a/Completion/Unix/Command/_dropbox b/Completion/Unix/Command/_dropbox
new file mode 100644
index 000000000..115f9eb45
--- /dev/null
+++ b/Completion/Unix/Command/_dropbox
@@ -0,0 +1,66 @@
+#compdef dropbox
+
+if [[ CURRENT -eq 2 || $words[2] = help ]]; then
+  local -a line progs
+
+  _call_program command dropbox help |
+    while read -A line; do
+	if [[ $line[1] = [a-z]## ]]; then
+	  progs+=("${line[1]}:${line[2,-1]}")
+	fi
+    done
+
+  _describe -t command 'Dropbox command' progs
+else
+  local -a opts
+
+  case $words[2] in
+    (exclude)
+    _path_files -g '*(/)'
+    ;;
+
+    (filestatus)
+    shift words
+    (( CURRENT-- ))
+    _arguments -s : \
+       '(-l --list)'{-l,--list}'[use format like ls]' \
+       '(-a --all)'{-a,--all}'[do not ignore entries starting .]' \
+       '*:File to list:_files'
+    ;;
+
+    (ls|puburl|sharelink)
+    _files
+    ;;
+
+    (autostart|lansync)
+    opts=("y:turn $words[2] on" "n:turn $words[2] off")
+    _describe "$words[2] behaviour" opts
+    ;;
+
+    (proxy)
+    _arguments \
+      '2:proxy mode:(none auto manual)' \
+      '3:proxy type for manual mode:(http socks4 socks5)' \
+      '4:proxy host for manual mode:_hosts' \
+      '5:proxy port for manual mode:_ports' \
+      '6:proxy user for manual mode:_users' \
+      '7:proxy password for manual mode:'
+    ;;
+
+    (start)
+    shift words
+    (( CURRENT-- ))
+    _arguments -s : '(-i --install)'{-i,--install}'[auto install dropboxd]'
+    ;;
+
+    (throttle)
+    _arguments \
+      '2:download limit in KB/s:(unlimited)' \
+      '3:upload limit in KB/s:(unlimited)'
+    ;;
+
+    (*)
+    _default
+    ;;
+  esac
+fi