forked from yiisoft/yii2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-pjax-automatic-id
- Loading branch information
Showing
100 changed files
with
4,857 additions
and
425 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# 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 | ||
# For permanent availability, copy or link this file to /etc/bash_completion.d/ | ||
# | ||
|
||
_yii() | ||
{ | ||
local cur opts yii command | ||
COMPREPLY=() | ||
cur="${COMP_WORDS[COMP_CWORD]}" | ||
yii="${COMP_WORDS[0]}" | ||
|
||
# exit if ./yii does not exist | ||
test -f $yii || return 0 | ||
|
||
# lookup for command | ||
for word in ${COMP_WORDS[@]:1}; do | ||
if [[ $word != -* ]]; then | ||
command=$word | ||
break | ||
fi | ||
done | ||
|
||
[[ $cur == $command ]] && state="command" | ||
[[ $cur != $command ]] && state="option" | ||
[[ $cur = *=* ]] && state="value" | ||
|
||
case $state in | ||
command) | ||
# complete command/route if not given | ||
# fetch available commands from ./yii help/list command | ||
opts=$($yii help/list 2> /dev/null) | ||
;; | ||
option) | ||
# fetch available options from ./yii help/list-action-options command | ||
opts=$($yii help/list-action-options $command 2> /dev/null | grep -o '^--[a-zA-Z0-9]*') | ||
;; | ||
value) | ||
# TODO allow normal file completion after an option, e.g. --migrationPath=... | ||
;; | ||
esac | ||
|
||
# generate completion suggestions | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||
return 0 | ||
|
||
} | ||
|
||
# register completion for the ./yii command | ||
# you may adjust this line if your command file is named differently | ||
complete -F _yii ./yii yii |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#compdef yii | ||
|
||
_yii() { | ||
local state command lastArgument commands options executive | ||
lastArgument=${words[${#words[@]}]} | ||
executive=$words[1] | ||
|
||
# lookup for command | ||
for word in ${words[@]:1}; do | ||
if [[ $word != -* ]]; then | ||
command=$word | ||
break | ||
fi | ||
done | ||
|
||
|
||
[[ $lastArgument == $command ]] && state="command" | ||
[[ $lastArgument != $command ]] && state="option" | ||
|
||
case $state in | ||
command) | ||
commands=("${(@f)$(${executive} help/list 2>/dev/null)}") | ||
_describe 'command' commands | ||
;; | ||
option) | ||
options=("${(@f)$(${executive} help/usage ${command} 2>/dev/null)}") | ||
_message -r "$options" | ||
|
||
suboptions=("${(@f)$(${executive} help/list-action-options ${command} 2>/dev/null)}") | ||
_describe -V -o -t suboption 'action options' suboptions | ||
;; | ||
*) | ||
esac | ||
|
||
} | ||
|
||
compdef _yii yii | ||
|
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
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
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
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
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
Oops, something went wrong.