zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: rdesktop completion
Date: Tue, 21 Oct 2014 20:42:20 +0200	[thread overview]
Message-ID: <21326.1413916940@thecus.kiddle.eu> (raw)

New completion function.

Oliver

diff --git a/Completion/X/Command/_rdesktop b/Completion/X/Command/_rdesktop
new file mode 100644
index 0000000..0bd08d9
--- /dev/null
+++ b/Completion/X/Command/_rdesktop
@@ -0,0 +1,71 @@
+#compdef rdesktop
+
+local curcontext="$curcontext" state line expl redir ret=1
+typeset -A opt_args
+
+_arguments -C -s \
+  '-u[username]:username:_users' \
+  '-d[domain]:domain' \
+  '-s[shell]:startup shell' \
+  '-c[working directory]:directory:_directories' \
+  '-p[password]:password' \
+  '-n[hostname]:host:_hosts' \
+  '-k[keyboard map]:keyboard map' \
+  '(-f)-g[geometry]:geometry (WxH)' \
+  '(-g)-f[fullscreen mode]' \
+  '-b[force server to use bitmaps for screen updates]' \
+  '-B[use X server backing store]' \
+  '-E[disable encryption]' \
+  "-m[don't send mouse motion events]" \
+  '-C[use private colormap]' \
+  '-D[hide window decorations]' \
+  '-K[do not override window manager key bindings]' \
+  '-S[single application mode]' \
+  '-T[set window title]:title' \
+  '-N[enable numlock synchronisation]' \
+  '-X[embed in another window]:window:_x_window' \
+  '-a[colour depth]:depth:(8 15 16 24)' \
+  '-z[enable compression]' \
+  '-x[bandwidth performance behaviour]:experience:((b\:broadband l\:lan m\:modem))' \
+  '-P[enable bitmap caching]' \
+  '*-r[device redirection]: :->redirection' \
+  '-0[attach to server console]' \
+  '(-5)-4[use RDP version 4]' \
+  '(-4)-5[use RDP version 5]' \
+  ':server:->hostsport' && ret=0
+
+case $state in
+  hostsport)
+    if compset -P '*:'; then
+      _ports && ret=0
+    else
+      compset -S ':*'
+      _hosts && ret=0
+    fi
+  ;;
+  redirection)
+    redir="${PREFIX%%:*}"
+    if compset -P '*='; then
+      curcontext="${curcontext%:*}:$redir"
+      compset -P '*='
+      case $redir in
+	comport|lptport) _wanted devices expl device _files -g '*(-%)' && ret=0 ;;
+	disk) _directories && ret=0 ;;
+	printer) _printers && ret=0 ;;
+	scard) _message -e aliases 'alias name' ;;
+      esac
+    else
+      compset -S '=*'
+      _values -S : 'redirection' \
+	'comport:port' \
+	'disk:sharename' \
+	'lptport:lptport' \
+	'printer:printername:_printers -S=' \
+	'sound:sound:(local off remote)' \
+	'lspci' \
+	'scard:sound card name' && ret=0
+    fi
+  ;;
+esac
+ 
+return ret


                 reply	other threads:[~2014-10-21 18:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21326.1413916940@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).