summary refs log tree commit diff
diff options
context:
space:
mode:
authorSebastian Ramacher <sebastian@ramacher.at>2014-07-26 21:57:39 +0200
committerAxel Beckert <abe@deuxchevaux.org>2014-07-26 21:58:11 +0200
commita7d7c77b7b635841198a732d76135d6097dd7aef (patch)
tree325660f8c09571692d55d936ff46f4c4db598ff5
parent33351b14f6195b483d5007749251087d1f6ea1df (diff)
downloadzsh-a7d7c77b7b635841198a732d76135d6097dd7aef.tar.gz
zsh-a7d7c77b7b635841198a732d76135d6097dd7aef.tar.xz
zsh-a7d7c77b7b635841198a732d76135d6097dd7aef.zip
32816: Add completion for bpython and variants
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_bpython46
2 files changed, 49 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f71be456e..2f1d6e135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
 	* Omari Norman: 32817: Add completion for moosic.
 
+	* Sebastian Ramacher: 32816: Add completion for bpython and
+	variants.
+
 2014-07-24  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 32853: configure.ac, Src/mem.c, Src/zsh_system.h: redefine
diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython
new file mode 100644
index 000000000..e83547853
--- /dev/null
+++ b/Completion/Unix/Command/_bpython
@@ -0,0 +1,46 @@
+#compdef bpython bpython-gtk bpython-urwid
+
+local -a all_opts urwid_opts gtk_opts
+
+all_opts=(
+  '--config[configuration file]:config file:_files'
+  '-h --help[show help message]'
+  '(-i --interactive)'{-i,--interactive}'[drop to bpython after running a file]'
+  '(-q --quiet)'{-q,--quiet}'[do not flush the output to stdout]'
+  '(-V --version)'{-V,--version}'[print version]'
+  '1:script:_files -g "*.u#py(-.)"'
+  '*:arguments:'
+)
+
+urwid_opts=(
+  '(-r --reactor)'{-r,--reactor}'[use Twisted reactor instead of the event loop]:reactor:'
+  '--help-reactors[display list of available Twisted reactors]'
+  '(-p --plugin)'{-p,--plugin}'[exectue a twistd plugin]:plugin:'
+  '(-s --server)'{-s,--server}'[run an eval server on the given port]:port:'
+)
+
+gtk_opts=(
+  '--socket-id[embed bpython]:socket id:'
+)
+
+case "$service" in
+  bpython)
+    _arguments \
+      "$all_opts[@]" && return 0
+  ;;
+
+  bpython-urwid)
+    _arguments \
+      "$all_opts[@]" \
+      "$urwid_opts[@]" && return 0
+  ;;
+
+  bpython-gtk)
+    _arguments \
+      "$all_opts[@]" \
+      "$gtk_opts[@]" && return 0
+  ;;
+esac
+
+
+# vim:autoindent expandtab shiftwidth=2 tabstop=2 softtabstop=2 filetype=zsh