Hub: Hub autocomplete doesn't show hub create as an option (zsh)

Created on 4 Dec 2019  ·  7Comments  ·  Source: github/hub

Command attempted:
hub c (press TAB)

What happened:
checkout -- checkout a branch or paths to the working tree
clone -- clone a repository into a new directory
commit -- record changes to the repository
cat-file check-mailmap checkout-index citool column commit-tree credential credential-osxkeychain cvsimport check-attr check-ref-format cherry clean commit config credential-cache credential-store cvsserver check-ignore checkout cherry-pick clone commit-graph count-objects credential-netrc cvsexportcommit

More info:
git version 2.22.0
hub version 2.12.3
x86_64-apple-darwin19.0

bug

All 7 comments

Does any hub command show up, e.g. pull-request? Check with hub pu<Tab>

Hmm, it does not. Only thing it shows is pull. I thought I saw hub specific autocompletes earlier but looks like I may have been mistaken.

Is hub aliased as "git"? See https://github.com/github/hub/issues/1792#issuecomment-403413131

also happen to hub browse, I had done the alias git=hub but the problem persists

I am also having issues with zsh completion:

❯ git --version
git version 2.24.1
hub version 2.13.0-ga5fbf29b

❯ zsh --version
zsh 5.7.1 (x86_64-apple-darwin17.7.0)

❯ type -f git
git is an alias for hub

In bash, this hack works once both git and hub completion scripts are loaded.

The --list-cmds command, which is supposed to be used by the latest completion script versions works:

❯ git --list-cmds=others
credential-gcloud.sh
delete-squashed
icdiff
alias
api
browse
ci-status
compare
create
delete
fork
gist
issue
pr
pull-request
release
sync

Edit: I finally fixed the problem. I made sure I had the latest versions of both git and hub, then I removed one of the _git files according to this comment: https://github.com/github/hub/issues/1956#issue-386168228 (that is, no more _git file in /usr/local/share/zsh/site-functions). I also made sure /usr/local/share/zsh/site-functions/_hub was pointing to the right/latest file.

Unfortunately I'm still experiencing issues, even after following suggestions from https://github.com/github/hub/issues/2381#issuecomment-567434610.

hub <TAB> is not displaying any completion (only local files), while git completion is working fine after enabling setopt completealiases.

This is my environment:

~ 
❯ git --version
git version 2.25.0
hub version 2.13.0

~ 
❯ zsh --version
zsh 5.7.1 (x86_64-apple-darwin18.2.0)

~ 
❯ type -f git
git is an alias for hub

~ 
❯ setopt
alwaystoend
autocd
autopushd
combiningchars
completealiases
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
login
longlistjobs
monitor
nonomatch
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle
  • git, hub and zsh installed via brew
  • oh-my-zsh installed
  • using the github plugin for oh-my-zsh.

Also, this is my $FPATH (formatted for better reading):

/Users/claudio.mezzasalma/.oh-my-zsh/custom/plugins/zsh-nvm
/Users/claudio.mezzasalma/.oh-my-zsh/custom/plugins/zsh-autosuggestions
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/yarn
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/tmux
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/rand-quote
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/osx
/Users/claudio.mezzasalma/.oh-my-zsh/custom/plugins/oc
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/npm
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/ng
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/mvn
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/github
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/git-extras
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/git
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/extract
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/docker
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/brew
/Users/claudio.mezzasalma/.oh-my-zsh/plugins/aws
/Users/claudio.mezzasalma/.oh-my-zsh/functions
/Users/claudio.mezzasalma/.oh-my-zsh/completions
/usr/local/share/zsh-completions
/usr/local/share/zsh/site-functions
/usr/share/zsh/site-functions
/usr/share/zsh/5.7.1/functions

I'm also experiencing this.

Versions:

% hub --version
git version 2.28.0
hub version 2.14.2

% zsh --version
zsh 5.8 (x86_64-apple-darwin19.3.0)

(git, hub and zsh are installed via Homebrew)

.zshrc (reduced to minimal):

autoload -Uz compinit
compinit

fpath:

% echo $fpath
/usr/local/share/zsh/site-functions /usr/local/Cellar/zsh/5.8/share/zsh/functions
Was this page helpful?
0 / 5 - 0 ratings