Autocompletion & Makefile
This commit is contained in:
parent
2db971234a
commit
16f1bef125
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
all:
|
||||
@echo -e "\n\033[1;36m --> Installing the module ...\033[0m\n"
|
||||
pip install --user -e .
|
||||
@echo -ne "\n\033[1;36m"; \
|
||||
read -p " --> Install autocompletion ?[Y|n] " RESP; \
|
||||
echo -e "\n\033[0m"; \
|
||||
case "$$RESP" in \
|
||||
y*|Y*|"")sudo cp -v completion.bash /usr/share/bash-completion/completions/shlax;; \
|
||||
*);; \
|
||||
esac;
|
||||
14
completion.bash
Normal file
14
completion.bash
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
_action(){
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
if [[ "$COMP_CWORD" -eq 1 ]] ; then
|
||||
COMPREPLY=($(compgen -W "$(ls shlax/repo/*.py | sed s/^.*\\/\// | cut -d "." -f 1)" "${cur}"))
|
||||
else
|
||||
action=$(grep "^[^ #)]\w* =" shlax/repo/${COMP_WORDS[1]}.py | cut -d " " -f 1)
|
||||
COMPREPLY=($(compgen -W "$action" "${cur}"))
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _action shlax
|
||||
Loading…
x
Reference in New Issue
Block a user