Skip to content

Commit

Permalink
done with transport bash autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
yyfrankyy committed Jun 8, 2011
1 parent 268163b commit 99a3632
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# @file bash.sh
# @fileoverview: //
# @author: 鏂囨渤([email protected])
# @usage: ./bash.sh
# @version: 1.0
# @create: 06/08/2011 08:45:19 PM CST

module="file"

if [[ $module == "file" ]]; then
echo 1;
fi
32 changes: 32 additions & 0 deletions bin/spm-autocompletion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# @file spm-autocompletion.sh
# @fileoverview: spm autocomplete
# @author: yyfrankyy([email protected])
# @usage: ./spm-autocompletion.sh
# @version: 1.0
# @create: 06/08/2011 08:17:16 PM CST

_spm() {
local spm cur action modules actions
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
spm="${COMP_WORDS[0]}"
action="${COMP_WORDS[1]}"
actions="transport help"

modules=`ls modules`
case "${action}" in
transport)
COMPREPLY=( $(compgen -W "${modules}" -- ${cur}) )
return 0
;;
esac

if [[ "${spm}" == "spm" ]]; then
COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) )
return 0;
fi
}

complete -F _spm spm

0 comments on commit 99a3632

Please sign in to comment.