From b7916dd271192464ebb101685917ec4139b78857 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 9 Sep 2016 00:31:12 +1200 Subject: Add completion for git-remote --- bash/bash_completion.d/git.bash | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bash') diff --git a/bash/bash_completion.d/git.bash b/bash/bash_completion.d/git.bash index 8e10910b..34a6f5ef 100644 --- a/bash/bash_completion.d/git.bash +++ b/bash/bash_completion.d/git.bash @@ -52,6 +52,32 @@ _git() { 2>/dev/null) ;; + # Complete with remote subcommands and then remote names + remote) + local word + while IFS= read -r word ; do + [[ -n $word ]] || continue + COMPREPLY[${#COMPREPLY[@]}]=$word + done < <( + if ((COMP_CWORD - sci > 1)) ; then + git remote 2>/dev/null + else + compgen -W ' + add + get-url + prune + remove + rename + set-branches + set-head + set-url + show + update + ' -- "${COMP_WORDS[COMP_CWORD]}" + fi + ) + ;; + # Complete with ref names *) local ref -- cgit v1.2.3