completion: teach submodule subcommands to complete options
Each submodule subcommand has specific long-options. Therefore, teach bash completion to support option completion based on the current subcommand. All long-options that are mentioned in the man-page synopsis are added. Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com> Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
6e3a7b3398
commit
65d5a1e0a5
@ -2556,10 +2556,11 @@ _git_submodule ()
|
|||||||
__git_has_doubledash && return
|
__git_has_doubledash && return
|
||||||
|
|
||||||
local subcommands="add status init deinit update summary foreach sync"
|
local subcommands="add status init deinit update summary foreach sync"
|
||||||
if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if [ -z "$subcommand" ]; then
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--quiet --cached"
|
__gitcomp "--quiet"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
@ -2567,6 +2568,33 @@ _git_submodule ()
|
|||||||
esac
|
esac
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$subcommand,$cur" in
|
||||||
|
add,--*)
|
||||||
|
__gitcomp "--branch --force --name --reference --depth"
|
||||||
|
;;
|
||||||
|
status,--*)
|
||||||
|
__gitcomp "--cached --recursive"
|
||||||
|
;;
|
||||||
|
deinit,--*)
|
||||||
|
__gitcomp "--force --all"
|
||||||
|
;;
|
||||||
|
update,--*)
|
||||||
|
__gitcomp "
|
||||||
|
--init --remote --no-fetch
|
||||||
|
--recommend-shallow --no-recommend-shallow
|
||||||
|
--force --rebase --merge --reference --depth --recursive --jobs
|
||||||
|
"
|
||||||
|
;;
|
||||||
|
summary,--*)
|
||||||
|
__gitcomp "--cached --files --summary-limit"
|
||||||
|
;;
|
||||||
|
foreach,--*|sync,--*)
|
||||||
|
__gitcomp "--recursive"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_git_svn ()
|
_git_svn ()
|
||||||
|
Reference in New Issue
Block a user