[Title]bashscript for auto completion 58/10658/1
authorhyunsik.noh <hyunsik.noh@samsung.com>
Tue, 8 Oct 2013 09:07:57 +0000 (18:07 +0900)
committerhyunsik.noh <hyunsik.noh@samsung.com>
Tue, 8 Oct 2013 09:07:57 +0000 (18:07 +0900)
tizen [new file with mode: 0644]

diff --git a/tizen b/tizen
new file mode 100644 (file)
index 0000000..a8f9a0d
--- /dev/null
+++ b/tizen
@@ -0,0 +1,25 @@
+#Should be fix binary name and path before to test this.
+#1. move this file to /etc/bash_completion.d
+#2. execute ". /etc/bash_completion"
+#3. test after "tizen" command
+_tizen()
+{
+       local cur prev args
+       COMPREPLY=()
+       cur="${COMP_WORDS[COMP_CWORD]}"
+       prev="${COMP_WORDS[COMP_CWORD-1]}"
+       args=""
+
+       for ((i=0; i < ${COMP_CWORD} ; i++))
+       do
+               args="${args} ${COMP_WORDS[i]}"
+       done    
+       
+       next=$(java -cp /home/hyunsik/workspace_pde_develop/test/bin TizenAutoComplete "${args}")
+       COMPREPLY=($(compgen -W "${next}" -- ${cur}))
+
+       return 0
+       
+}
+
+complete -F _tizen tizen