Github is awesome for hosting code repositories. One of the more awesome things is their API that let's you do (almost?) anything you can do via the website. I like that, because that lets me write things that make me avoit the web interface (yes, I'm a CLI addict). And a python addict, so I was excited to see Ian Cordasco's github3.py. One thing I really wanted was to make it easier to fork/clone a repository. Yes, I'm aware of hub, but don't like it for two opinionated reasons: It wraps git instead of being a git subcommand, which feels dirty. And it's ruby, which feels dirty too :)
Besides, the best way to learn something is to tinker. So tinker I did. The result is git hub, a git subcommand that does various github actions.
dennis@lightning:~$ git hub whoami
Dennis Kaarsemaker
Profile https://github.com/seveas
Email dennis@kaarsemaker.net
Blog http://www.kaarsemaker.net
Location Amsterdam
Company Booking.com
Repos 36 public, 0 private
Gists 4 public, 0 private
RSA key ...N0nFw3oW5l (Dennis)
And that's just the beginning. I've already used it to fork and/or clone repos, fix repo configs and file pull requests. And of course it has a graphviz thing that visualizes part of your social coding network. Another thing I used is docopt for creating the command line interface (options and arguments). Instead of having to declare all options manually with optparse or argparse and have your --help output be autogenerated, it works the other way around: you write your usage info and it generates the parser. Much less annoying!
More info on github (where else).
Marius Gedminas on 10/11/2012 10:33 a.m. #
It'd be nice to get this with 'pip install git-hub', but that name appears to be already taken on PyPI. Do you know what's up with that?
I'm also wondering if it would be possible to do the authentication via a web browser (doesn't GitHub use OAuth?) instead of giving the command-line tool my password and keeping it in another plain-text file in the home directory.
Dennis Kaarsemaker on 10/11/2012 10:39 a.m. #
I've mailed Kenneth about the git-hub name, but have not received a response yet.
And it *is* using OAuth: the thing stored in your homefolder is the application's OAuth token. The password is needed only once to generate that token and not stored anywhere. If you go to your github profile, you can also see the application and revoke its access if you want.