2012-09-30 19:53:26 +00:00
|
|
|
#compdef git-submodule-move
|
|
|
|
#autoload
|
|
|
|
|
|
|
|
#
|
|
|
|
# Completes git-submodule-move.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2014-07-13 10:36:15 +00:00
|
|
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
2012-09-30 19:53:26 +00:00
|
|
|
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 < <(
|
2014-07-13 10:36:15 +00:00
|
|
|
command git config --file "$(git-root)/.gitmodules" --list \
|
2012-09-30 19:53:26 +00:00
|
|
|
| grep '.path=' \
|
|
|
|
| cut -d= -f2-
|
|
|
|
)
|
|
|
|
|
|
|
|
_describe -t submodule 'submodules' submodules && ret=0
|
|
|
|
;;
|
|
|
|
(directory)
|
|
|
|
_wanted directories expl 'directory' _path_files -/ || _message 'directory'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
return $ret
|
|
|
|
|