Open mislav opened 11 years ago
I think that's a much better solution. Something like:
$ hub doctor
Please run this command as:
eval "$(hub doctor)"
$ eval "$(hub doctor)"
✘ Unable to locate "git" command!
✘ "git" is aliased to "hub" but the COMPLETE_ALIASES zsh option is set.
This will prevent completing hub commands when typing "git <TAB>". To fix,
put "unsetopt complete_aliases" in your .zshrc.
$ echo $?
1
$ ... fix issues ...
$ eval "$(hub doctor)"
✔ Your system appears to be properly configured for hub.
$ echo $?
0
I would probably put the ✘ in red and the ✔ in green.
Again, it will probably be a little while before I can implement this.
You don't need to make it so fancy. Just outputting a few plain ol' warnings would do.
Also, I would namespace it under hub hub doctor
just as hub hub standalone
. This makes sure we don't shadow potential git-doctor
command (someone might have it, who knows??) with our helper which is not even a real command.
Having this issue now. unsetopt complete_aliases
does not fix it.
@nixpulvis How are you sure that your problem is caused by this zsh option?
Also, you have to unset the option before anything calls out to git. Preferrably very early in your dotfiles.
I'm sorry, it was an issue with my zsh env environment.
setopt complete_aliases
:This breaks our current zsh completion. I guess what happens is that it skips
_hub
completion and loads_git
directly?@goodell tried to solve this in goodell/hub@aa1675d but I feel that this approach is too brittle. Maybe we shouldn't be trying to fix this, and have people disable
complete_aliases
? Why do people set it in the first place?So far I've counted the option enabled in Holman's and Pengwynn's dotfiles. It is not enabled in Oh-my-zsh (thanks @blueyed for robbyrussell/oh-my-zsh#241) nor Prezto.
@goodell: Would it be possible to create some kind of "doctor" script which you could eval in your zsh and it will tell you if the completion is hooked up OK and whether you need to fix something about your environment?