Merge branch 'cw/completion'
More command line completion (in contrib/) for recent additions. * cw/completion: completion: recognize more long-options completion: teach remote subcommands to complete options completion: teach replace to complete options completion: teach ls-remote to complete options completion: improve bash completion for git-add completion: add subcommand completion for rerere completion: teach submodule subcommands to complete options
This commit is contained in:
@ -936,6 +936,7 @@ _git_apply ()
|
|||||||
--apply --no-add --exclude=
|
--apply --no-add --exclude=
|
||||||
--ignore-whitespace --ignore-space-change
|
--ignore-whitespace --ignore-space-change
|
||||||
--whitespace= --inaccurate-eof --verbose
|
--whitespace= --inaccurate-eof --verbose
|
||||||
|
--recount --directory=
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
@ -947,13 +948,17 @@ _git_add ()
|
|||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--interactive --refresh --patch --update --dry-run
|
--interactive --refresh --patch --update --dry-run
|
||||||
--ignore-errors --intent-to-add
|
--ignore-errors --intent-to-add --force --edit --chmod=
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# XXX should we check for --update and --all options ?
|
local complete_opt="--others --modified --directory --no-empty-directory"
|
||||||
__git_complete_index_file "--others --modified --directory --no-empty-directory"
|
if test -n "$(__git_find_on_cmdline "-u --update")"
|
||||||
|
then
|
||||||
|
complete_opt="--modified"
|
||||||
|
fi
|
||||||
|
__git_complete_index_file "$complete_opt"
|
||||||
}
|
}
|
||||||
|
|
||||||
_git_archive ()
|
_git_archive ()
|
||||||
@ -970,7 +975,7 @@ _git_archive ()
|
|||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--format= --list --verbose
|
--format= --list --verbose
|
||||||
--prefix= --remote= --exec=
|
--prefix= --remote= --exec= --output
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@ -1025,6 +1030,7 @@ _git_branch ()
|
|||||||
--track --no-track --contains --merged --no-merged
|
--track --no-track --contains --merged --no-merged
|
||||||
--set-upstream-to= --edit-description --list
|
--set-upstream-to= --edit-description --list
|
||||||
--unset-upstream --delete --move --remotes
|
--unset-upstream --delete --move --remotes
|
||||||
|
--column --no-column --sort= --points-at
|
||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -1138,6 +1144,8 @@ _git_clone ()
|
|||||||
--single-branch
|
--single-branch
|
||||||
--branch
|
--branch
|
||||||
--recurse-submodules
|
--recurse-submodules
|
||||||
|
--no-single-branch
|
||||||
|
--shallow-submodules
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@ -1179,6 +1187,7 @@ _git_commit ()
|
|||||||
--reset-author --file= --message= --template=
|
--reset-author --file= --message= --template=
|
||||||
--cleanup= --untracked-files --untracked-files=
|
--cleanup= --untracked-files --untracked-files=
|
||||||
--verbose --quiet --fixup= --squash=
|
--verbose --quiet --fixup= --squash=
|
||||||
|
--patch --short --date --allow-empty
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
@ -1197,7 +1206,7 @@ _git_describe ()
|
|||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--all --tags --contains --abbrev= --candidates=
|
--all --tags --contains --abbrev= --candidates=
|
||||||
--exact-match --debug --long --match --always
|
--exact-match --debug --long --match --always --first-parent
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
esac
|
esac
|
||||||
@ -1280,6 +1289,7 @@ __git_fetch_recurse_submodules="yes on-demand no"
|
|||||||
__git_fetch_options="
|
__git_fetch_options="
|
||||||
--quiet --verbose --append --upload-pack --force --keep --depth=
|
--quiet --verbose --append --upload-pack --force --keep --depth=
|
||||||
--tags --no-tags --all --prune --dry-run --recurse-submodules=
|
--tags --no-tags --all --prune --dry-run --recurse-submodules=
|
||||||
|
--unshallow --update-shallow
|
||||||
"
|
"
|
||||||
|
|
||||||
_git_fetch ()
|
_git_fetch ()
|
||||||
@ -1329,7 +1339,7 @@ _git_fsck ()
|
|||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--tags --root --unreachable --cache --no-reflogs --full
|
--tags --root --unreachable --cache --no-reflogs --full
|
||||||
--strict --verbose --lost-found
|
--strict --verbose --lost-found --name-objects
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@ -1373,6 +1383,8 @@ _git_grep ()
|
|||||||
--max-depth
|
--max-depth
|
||||||
--count
|
--count
|
||||||
--and --or --not --all-match
|
--and --or --not --all-match
|
||||||
|
--break --heading --show-function --function-context
|
||||||
|
--untracked --no-index
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@ -1445,6 +1457,12 @@ _git_ls_files ()
|
|||||||
|
|
||||||
_git_ls_remote ()
|
_git_ls_remote ()
|
||||||
{
|
{
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "--heads --tags --refs --get-url --symref"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
__gitcomp_nl "$(__git_remotes)"
|
__gitcomp_nl "$(__git_remotes)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1566,7 +1584,7 @@ _git_mergetool ()
|
|||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--tool="
|
__gitcomp "--tool= --prompt --no-prompt"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -2374,40 +2392,88 @@ _git_config ()
|
|||||||
|
|
||||||
_git_remote ()
|
_git_remote ()
|
||||||
{
|
{
|
||||||
local subcommands="add rename remove set-head set-branches set-url show prune update"
|
local subcommands="
|
||||||
|
add rename remove set-head set-branches
|
||||||
|
get-url set-url show prune update
|
||||||
|
"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]; then
|
||||||
__gitcomp "$subcommands"
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "--verbose"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$subcommand" in
|
case "$subcommand,$cur" in
|
||||||
rename|remove|set-url|show|prune)
|
add,--*)
|
||||||
__gitcomp_nl "$(__git_remotes)"
|
__gitcomp "--track --master --fetch --tags --no-tags --mirror="
|
||||||
;;
|
;;
|
||||||
set-head|set-branches)
|
add,*)
|
||||||
|
;;
|
||||||
|
set-head,--*)
|
||||||
|
__gitcomp "--auto --delete"
|
||||||
|
;;
|
||||||
|
set-branches,--*)
|
||||||
|
__gitcomp "--add"
|
||||||
|
;;
|
||||||
|
set-head,*|set-branches,*)
|
||||||
__git_complete_remote_or_refspec
|
__git_complete_remote_or_refspec
|
||||||
;;
|
;;
|
||||||
update)
|
update,--*)
|
||||||
|
__gitcomp "--prune"
|
||||||
|
;;
|
||||||
|
update,*)
|
||||||
__gitcomp "$(__git_get_config_variables "remotes")"
|
__gitcomp "$(__git_get_config_variables "remotes")"
|
||||||
;;
|
;;
|
||||||
|
set-url,--*)
|
||||||
|
__gitcomp "--push --add --delete"
|
||||||
|
;;
|
||||||
|
get-url,--*)
|
||||||
|
__gitcomp "--push --all"
|
||||||
|
;;
|
||||||
|
prune,--*)
|
||||||
|
__gitcomp "--dry-run"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
|
__gitcomp_nl "$(__git_remotes)"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_git_replace ()
|
_git_replace ()
|
||||||
{
|
{
|
||||||
|
case "$cur" in
|
||||||
|
--*)
|
||||||
|
__gitcomp "--edit --graft --format= --list --delete"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
__gitcomp_nl "$(__git_refs)"
|
__gitcomp_nl "$(__git_refs)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_git_rerere ()
|
||||||
|
{
|
||||||
|
local subcommands="clear forget diff remaining status gc"
|
||||||
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
if test -z "$subcommand"
|
||||||
|
then
|
||||||
|
__gitcomp "$subcommands"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_git_reset ()
|
_git_reset ()
|
||||||
{
|
{
|
||||||
__git_has_doubledash && return
|
__git_has_doubledash && return
|
||||||
|
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--merge --mixed --hard --soft --patch"
|
__gitcomp "--merge --mixed --hard --soft --patch --keep"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -2423,7 +2489,10 @@ _git_revert ()
|
|||||||
fi
|
fi
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
--*)
|
--*)
|
||||||
__gitcomp "--edit --mainline --no-edit --no-commit --signoff"
|
__gitcomp "
|
||||||
|
--edit --mainline --no-edit --no-commit --signoff
|
||||||
|
--strategy= --strategy-option=
|
||||||
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -2451,7 +2520,7 @@ _git_shortlog ()
|
|||||||
__gitcomp "
|
__gitcomp "
|
||||||
$__git_log_common_options
|
$__git_log_common_options
|
||||||
$__git_log_shortlog_options
|
$__git_log_shortlog_options
|
||||||
--numbered --summary
|
--numbered --summary --email
|
||||||
"
|
"
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@ -2556,10 +2625,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 +2637,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 ()
|
||||||
@ -2701,8 +2798,8 @@ _git_tag ()
|
|||||||
--*)
|
--*)
|
||||||
__gitcomp "
|
__gitcomp "
|
||||||
--list --delete --verify --annotate --message --file
|
--list --delete --verify --annotate --message --file
|
||||||
--sign --cleanup --local-user --force --column --sort
|
--sign --cleanup --local-user --force --column --sort=
|
||||||
--contains --points-at
|
--contains --points-at --merged --no-merged --create-reflog
|
||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Reference in New Issue
Block a user