mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-06 23:31:28 +02:00
42810: git remote set-url completion
This commit is contained in:
parent
7d905fd4fe
commit
e754b18ca7
2 changed files with 30 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2018-08-31 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||||
|
|
||||||
|
* 42810: pseyfert: Completion/Unix/Command/_git:
|
||||||
|
git remote set-url completion
|
||||||
|
|
||||||
2018-08-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
2018-08-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||||
|
|
||||||
* 43349: Completion/X/Command/_eog: new completion for eog
|
* 43349: Completion/X/Command/_eog: new completion for eog
|
||||||
|
@ -6,6 +11,9 @@
|
||||||
|
|
||||||
2018-08-29 Oliver Kiddle <okiddle@yahoo.co.uk>
|
2018-08-29 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||||
|
|
||||||
|
* 43351: Completion/Unix/Type/_diff_options: handle the new
|
||||||
|
diff implementation in the pre-release version of FreeBSD 12
|
||||||
|
|
||||||
* 43346: Completion/Linux/Command/_cryptsetup,
|
* 43346: Completion/Linux/Command/_cryptsetup,
|
||||||
Completion/Linux/Command/_networkmanager,
|
Completion/Linux/Command/_networkmanager,
|
||||||
Completion/Linux/Command/_strace, Completion/Unix/Command/_attr,
|
Completion/Linux/Command/_strace, Completion/Unix/Command/_attr,
|
||||||
|
|
|
@ -3610,10 +3610,7 @@ _git-remote () {
|
||||||
':repository:->repository' && ret=0
|
':repository:->repository' && ret=0
|
||||||
case $state in
|
case $state in
|
||||||
(repository)
|
(repository)
|
||||||
_alternative \
|
__git_repositories_or_url && ret=0
|
||||||
'local-repositories::__git_local_repositories' \
|
|
||||||
'remote-repositories::__git_remote_repositories' \
|
|
||||||
'urls::_urls' && ret=0
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -3644,14 +3641,17 @@ _git-remote () {
|
||||||
'*: :__git_branch_names' && ret=0
|
'*: :__git_branch_names' && ret=0
|
||||||
;;
|
;;
|
||||||
(set-url)
|
(set-url)
|
||||||
# TODO: Old URL should be one of those defined for the remote.
|
# TODO: Old URL does not get completed if --push, --add, or --delete are present
|
||||||
|
# TODO: assumes $line[1] is always the remote name
|
||||||
|
_message "the line is: $line"
|
||||||
_arguments -S -s \
|
_arguments -S -s \
|
||||||
'(3)--push[manipulate push URLs instead of fetch URLs]' \
|
'(3)--push[manipulate push URLs instead of fetch URLs]' \
|
||||||
'--add[add URL to those already defined]' \
|
'--add[add URL to those already defined]' \
|
||||||
'(3)--delete[delete all matching URLs]' \
|
'(3)--delete[delete all matching URLs]' \
|
||||||
': :__git_remotes' \
|
': :__git_remotes' \
|
||||||
':new url:_urls' \
|
':new url:__git_repositories_or_url' \
|
||||||
':old url:_urls' && ret=0
|
':old url:__git_current_remote_url $line[1]' \
|
||||||
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(show)
|
(show)
|
||||||
_arguments -S \
|
_arguments -S \
|
||||||
|
@ -6971,6 +6971,21 @@ __git_local_repositories () {
|
||||||
_wanted local-repositories expl 'local repositories' _directories
|
_wanted local-repositories expl 'local repositories' _directories
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(( $+functions[__git_repositories_or_url] )) ||
|
||||||
|
__git_repositories_or_url () {
|
||||||
|
_alternative \
|
||||||
|
'repositories::__git_repositories' \
|
||||||
|
'url::_urls'
|
||||||
|
}
|
||||||
|
|
||||||
|
(( $+functions[__git_current_remote_url] )) ||
|
||||||
|
__git_current_remote_url () {
|
||||||
|
# TODO: is ${(@)*[1,4]} a proper replacement for $* and passing extra arguments?
|
||||||
|
# TODO: add --push to the `git remote get-url` command in case `git remote set-url --push origin <new url> <TAB>` is completed
|
||||||
|
_wanted remote-urls expl 'current urls' \
|
||||||
|
compadd ${(@)*[1,4]} - ${${(0)"$(_call_program remote-urls git remote get-url $5)"}%%$'\n'*}
|
||||||
|
}
|
||||||
|
|
||||||
(( $+functions[__git_any_repositories] )) ||
|
(( $+functions[__git_any_repositories] )) ||
|
||||||
__git_any_repositories () {
|
__git_any_repositories () {
|
||||||
# TODO: should also be $GIT_DIR/remotes/origin
|
# TODO: should also be $GIT_DIR/remotes/origin
|
||||||
|
|
Loading…
Reference in a new issue