From: hyunsik.noh Date: Tue, 8 Oct 2013 09:07:57 +0000 (+0900) Subject: [Title]bashscript for auto completion X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f83abc1937be917df995573248e1ef6d14c80130;p=sdk%2Ftools%2Fcli.git [Title]bashscript for auto completion --- diff --git a/tizen b/tizen new file mode 100644 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