done
}
- # completion for cdremote - list remotes with directories as URLs
- _cdremote_complete() {
+ # completion for cdremote and git-open - list remotes with a pattern
+ _list_remotes_completion() {
local cur="${COMP_WORDS[COMP_CWORD]}";
- _list_remotes '^\(/\|\.\./\)' # (/ or ../ at the beginning)
+ _list_remotes "$1"
COMPREPLY=(`compgen -W "$GIT_REMOTES" -- "$cur"`)
unset GIT_REMOTES
}
+ # completion for cdremote - list remotes with directories as URLs
+ _cdremote_complete() {
+ _list_remotes_completion '^\(/\|\.\./\)' # (/ or ../ at the beginning)
+ }
+
complete -F _cdremote_complete cdremote
# completion for git-open - list remotes with http(s) URLs
_git_open() {
- local cur="${COMP_WORDS[COMP_CWORD]}";
- _list_remotes '^http\(s\)\?://'
- COMPREPLY=(`compgen -W "$GIT_REMOTES" -- "$cur"`)
- unset GIT_REMOTES
+ _list_remotes_completion '^http\(s\)\?://'
}
complete -F _git_open git-open