Tuesday, September 6, 2016

Improving the user experience of hub

I can't remember things well,  So when possible rely tools (like bash completion) to help me complete or explore commands with linux so that I don't have to remember every commands 100+ options.

With hub, the same applies and you may not have bash-completion for this new tool. If you install it directly from the hub site. 

To help you solve that, you can do:
if [[ -f /usr/share/bash-completion/completions/hub ]]; then echo "hub bash-completion already installed"; else  sudo curl -o /usr/share/bash-completion/completions/hub https://raw.githubusercontent.com/github/hub/master/etc/hub.bash_completion.sh; fi
This relies on the bash-completion construct but its the simplest way to add completion commands to this new tool.
  • This also updates your "completion" commands for git so be aware that if you have not aliased "git > hub" your completion commands may not correctly display your available options.
It should also be noted that if your not installing the hub tooling from the project site directly (but instead using your OS's package manger), bash completion may already come with the software. Be sure to explore this (and reload your shell after installing).