]> gitweb.fluxo.info Git - hydra.git/commitdiff
Adding bash completion skeleton
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 13 Jul 2013 02:57:19 +0000 (23:57 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 13 Jul 2013 02:57:19 +0000 (23:57 -0300)
lib/hydra/completions/bash [new file with mode: 0644]

diff --git a/lib/hydra/completions/bash b/lib/hydra/completions/bash
new file mode 100644 (file)
index 0000000..a416c78
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# Hydra Suite bash completion
+#
+
+_hydra() {
+  # Standard stuff
+  local cur prev opts config
+  COMPREPLY=()
+  cur="${COMP_WORDS[COMP_CWORD]}"
+  prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+  # Initial options
+  config="$HOME/.hydra"
+  opts="`ls $config | sed -e 's/config//'`"
+
+  # Available instances
+  instances="`echo $opts | sed -e 's/ /|/'`"
+
+  # The current instance
+  instance="${COMP_WORDS[1]}"
+
+  # Return the available options
+  COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+  return 0
+}
+
+_hydractl() {
+}
+
+complete -F _hydra hydra
+complete -F _hydractl hydractl