Added initial zsh completion support to git_index
zsh now completes all arguments and all directories inside $GIT_REPO_DIR. This is till buggy because not all directories in $GIT_REPO_DIR are actual git projects. Next update will include completing the list in the .git_index file.
This commit is contained in:
@@ -146,5 +146,7 @@ if [ $shell = "bash" ]; then
|
||||
# If you know how to rewrite _git_index_tab_completion() for zsh, please send me a pull request!
|
||||
complete -o nospace -F _git_index_tab_completion git_index
|
||||
complete -o nospace -F _git_index_tab_completion $git_index_alias
|
||||
else
|
||||
compdef _git_index_tab_completion git_index $git_index_alias
|
||||
fi
|
||||
|
||||
|
||||
@@ -281,8 +281,9 @@ function _git_index_batch_cmd() {
|
||||
}
|
||||
|
||||
|
||||
# Bash tab completion function for git_index()
|
||||
function _git_index_tab_completion() {
|
||||
if [ $shell = 'bash' ]; then
|
||||
# Bash tab completion function for git_index()
|
||||
function _git_index_tab_completion() {
|
||||
_check_git_index
|
||||
local curw
|
||||
IFS=$'\n'
|
||||
@@ -316,5 +317,30 @@ function _git_index_tab_completion() {
|
||||
fi
|
||||
IFS=$' \t\n'
|
||||
return 0
|
||||
}
|
||||
}
|
||||
else
|
||||
function _git_index_tab_completion() {
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
"--rebuild[Rebuild repository index]" \
|
||||
"--update-all[Update all indexed repositories]" \
|
||||
"--update-all-with-notifications[Update all indexed repositories with notifications]" \
|
||||
"--list[List all repositories currently present in the index]" \
|
||||
"--count-by-host[Count all repositories per host]" \
|
||||
"--batch-cmd+[Run a git command on all repositories]:git command:->git_command" \
|
||||
":Project name:->projects" \
|
||||
&& return 0
|
||||
|
||||
|
||||
case "$state" in
|
||||
projects)
|
||||
_files -/ -W $GIT_REPO_DIR
|
||||
;;
|
||||
git_command)
|
||||
;;
|
||||
esac
|
||||
|
||||
return 1;
|
||||
}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user