Created
March 22, 2013 19:44
-
-
Save gdugas/5224168 to your computer and use it in GitHub Desktop.
basic jelix bash_completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_jelix_completion() | |
{ | |
local cur prev opts actions | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
# Standalone options | |
opts="" | |
# Actions | |
actions="acl2group acl2right aclgroup aclright aclvalue cleartemp \ | |
closeapp createaction createclassfromdao createctrl \ | |
createdao createdaocrud createentrypoint createform \ | |
createlangpackage createmodule createzone help initadmin \ | |
installapp installmodule migrate openapp resetfilesrights" | |
if [[ # cmd.php | |
( ${COMP_CWORD} -eq 1 && ${COMP_WORDS[0]} == ./cmd.php ) || | |
# php cmd.php | |
( ${COMP_CWORD} -eq 2 && | |
$( basename -- ${COMP_WORDS[0]} ) == php?([1-9]\.[0-9]) && | |
$( basename -- ${COMP_WORDS[1]} ) == cmd.php ) ]]; then | |
COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) ) | |
action=$COMPREPLY | |
return 0 | |
else | |
case ${prev} in | |
help) | |
COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) ) | |
return 0 | |
;; | |
*) | |
COMPREPLY=() | |
return 0 | |
;; | |
esac | |
fi | |
} | |
complete -F _jelix_completion cmd.php | |
complete -F _jelix_completion php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created with jelix 1.4.x