Cocoa in the Shell

Using Alfred to clone a github repository

As a Mac OS / iOS developer I often download code from github, and well, opening a shell to type git clone url is quite painful.
Sure there is Visor which offers the possibility to have a quick access to a shell, but it needs SIMBL, and I don’t like to have this kind of plugins on my system.. Plus it’s not very reliable in time.

On the other hand we have Alfred which is just a great and lightweight application, especially with the Powerpack.
With version 0.9 came custom terminal commands, which are very powerful. It allows you to create shell command to execute via Alfred with a simple shortcut that you define, and you can even execute a command without showing a terminal and the task will be done silently in the background.
That’s seem pretty good to clone a repo right ? Only caveat, I need to know when the download is finished…

..But here comes Growl. When downloading Growl, in the Extras folder you can install growlnotify which is a command line utility to use Growl.

So with these 2 things installed I created a custom terminal command with the shortcut git which looks like this :

cd ~/Desktop;git clone "{query}";/usr/local/bin/growlnotify -m "Github download complete" --image ~/Dropbox/Applications\ Data/Alfred/extensions/scripts/git/icon.png
  • It first changes directory to the desktop.
  • Then it executes the git clone command.
  • Once it’s done it fires up a Growl notification with the image of the Alfred shortcut.

Now when I want to clone a repo, I just hit CTRL+Space, type git and paste the URL ;)

Very handy.

Tags: