changeset 1687:17fbcd8c00ac

Add Tab Completion to Bash Shell PR2284 Reviewed-by: jerboaa, omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-February/012554.html
author Lukasz Dracz <ldracz@redhat.com>
date Wed, 25 Mar 2015 12:27:37 -0400
parents 8b8acefac871
children f1daf6d1812f
files distribution/scripts/thermostat-completion
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/distribution/scripts/thermostat-completion	Wed Mar 25 12:27:37 2015 -0400
@@ -0,0 +1,17 @@
+#/bin/bash
+_thermostat() 
+{
+    local cur prev opts base
+    local thermostat_install_dir
+    thermostat_install_dir="${thermostat.home}"
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    # Thermostat Options
+    opts="$(${thermostat_install_dir}/bin/thermostat help | cut -d " " -f 2 | tr '\n' ' ' | cut -d " " -f 3-)"
+
+    COMPREPLY=($(compgen -W "${opts}" -- ${cur}))  
+    return 0
+}
+complete -F _thermostat thermostat