-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.sh
32 lines (27 loc) · 864 Bytes
/
register.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#mcedit ~/.bash_aliases
function acli() {
local PWD=$(pwd -P)
if [[ -f "$PWD/acli" ]] ; then
php acli "$@"
fi
}
function _acli_complete_()
{
local PWD=$(pwd -P)
if [[ -f "$PWD/acli" ]] ; then
#local pwds
#IFS='/' read -r -a pwds <<< "$PWD"
##mapfile -d / -t pwds <<<"$PWD/"
#projectName=${pwds[3]}
local cmd="${1##*/}"
local cur_word="${COMP_WORDS[COMP_CWORD]}"
local prev_word="${COMP_WORDS[COMP_CWORD-1]}"
local line_full=${COMP_LINE}
local line=$(printf " %s" "${COMP_WORDS[@]:1}"); line=${line:1}
local suggestAcli=$(php acli $line --silence_greetings --bash_completion_cword=$cur_word --cword_num=$COMP_CWORD)
COMPREPLY=($(compgen -W "$suggestAcli" -- $cur_word))
else
COMPREPLY=()
fi
}
complete -F _acli_complete_ acli