]> git.phdru.name Git - dotfiles.git/commitdiff
.shellrc: define completion for git-open - list remotes with http(s) URLs
authorOleg Broytman <phd@phdru.name>
Thu, 7 Jul 2016 15:30:10 +0000 (18:30 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 7 Jul 2016 15:30:10 +0000 (18:30 +0300)
.shellrc

index d0c9c37d5921a94ca8ae9d783113dfd781689863..38f7381a7b060becb2a9ceb9b5e6237fa1dca174 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -195,6 +195,17 @@ case "$SHELL" in
       }
 
       complete -F _cdremote_complete cdremote
+
+      # define 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"`)
+         GIT_REMOTES=""
+         unset GIT_REMOTES
+      }
+
+      complete -F _git_open git-open
    ;;
 esac