You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
8 years ago
|
# This file implements bash completion for the ./yii command file.
|
||
|
# It completes the commands available by the ./yii command.
|
||
|
# See also:
|
||
|
# - https://debian-administration.org/article/317/An_introduction_to_bash_completion_part_2 on how this works.
|
||
|
# - https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html
|
||
|
# - http://www.yiiframework.com/doc-2.0/guide-tutorial-console.html#bash-completion
|
||
|
#
|
||
|
# Usage:
|
||
|
# Temporarily you can source this file in you bash by typing: source yii.bash-completion
|
||
|
# For permanent availability, copy or link this file to /etc/bash_completion.d/
|
||
|
#
|
||
|
|
||
|
_yii()
|
||
|
{
|
||
|
local cur opts yii
|
||
|
COMPREPLY=()
|
||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||
|
yii="${COMP_WORDS[0]}"
|
||
|
|
||
|
# only complete first argument
|
||
|
if [[ COMP_CWORD -eq 1 ]] ; then
|
||
|
# fetch available commands from ./yii help/list command
|
||
|
opts=$($yii help/list)
|
||
|
# generate completion suggestions
|
||
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||
|
return 0
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# register completion for the ./yii command
|
||
|
# you may adjust this line if your command file is named differently
|
||
|
complete -F _yii ./yii
|