From 6ca7aa90ed0efe11e69a8f431c1213b67222696a Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Mon, 1 Feb 2021 21:31:01 +0000 Subject: [PATCH] bash: Fix completion for git-dotfiles and hub https://github.com/github/hub/issues/2684 --- .../bash-completion/completions/git-dotfiles | 9 +++++++-- .local/share/bash-completion/completions/hub | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .local/share/bash-completion/completions/hub diff --git a/.local/share/bash-completion/completions/git-dotfiles b/.local/share/bash-completion/completions/git-dotfiles index 98901480..df425b2e 100644 --- a/.local/share/bash-completion/completions/git-dotfiles +++ b/.local/share/bash-completion/completions/git-dotfiles @@ -1,4 +1,9 @@ #!bash +# shellcheck disable=SC2239 -. /usr/share/bash-completion/completions/git -complete -F _git git-dotfiles +if ! declare -F __git_complete >/dev/null; then + _completion_loader git +fi + +# FIXME: "git" instead of "__git_main" once https://github.com/git/git/commit/5a067ba9d04eebc92ad77f101b785219238f4f1e is released +__git_complete git-dotfiles __git_main diff --git a/.local/share/bash-completion/completions/hub b/.local/share/bash-completion/completions/hub new file mode 100644 index 00000000..b89eadfc --- /dev/null +++ b/.local/share/bash-completion/completions/hub @@ -0,0 +1,15 @@ +#!bash +# shellcheck disable=SC2239 + +# drop once https://github.com/github/hub/issues/2684 is released + +if ! declare -F __git_complete >/dev/null; then + _completion_loader git +fi + +function _git { __git_wrap__git_main "$@"; } + +. /usr/share/bash-completion/completions/hub + +__git_compute_all_commands +__git_all_commands=$({ __git_list_all_commands 2>/dev/null; echo "$__git_all_commands"; } | sort -u)