1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 23:08:00 +00:00
prezto/modules/git/functions/_git-submodule-move
Diego Rabatone Oliveira b3c27bb164 Replace git with 'command git' (#1551)
to improve performance if git is aliased to hub or other wrappers.
2018-03-05 00:56:25 -08:00

41 lines
793 B
Plaintext

#compdef git-submodule-move
#autoload
#
# Completes git-submodule-move.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
return 1
fi
local state expl ret=1
local -a submodules
local submodule
_arguments -C -s -S \
'1::args:->submodule' \
'2::args:->directory' && ret=0
case "$state" in
(submodule)
while IFS=$'\n' read submodule; do
submodules+=("$submodule")
done < <(
command git config --file "$(git-root)/.gitmodules" --list \
| grep '.path=' \
| cut -d= -f2-
)
_describe -t submodule 'submodules' submodules && ret=0
;;
(directory)
_wanted directories expl 'directory' _path_files -/ || _message 'directory'
;;
esac
return $ret