The Force.com CLI (command-line interface) was introduced at Dreamforce ’13 during the Developer Keynote to thunderous applause, for good reason. The Force.com CLI is very useful for executing quick commands without the overhead of pulling up a tool like the IDE or the Developer Console or logging into Salesforce directly. Additionally, it can be used in conjunction with other non Force.com CLI commands in the shell with piping or redirection (e.g., pipe to grep).
All of that is certainly great, but the icing on the cake is that it is open-sourced. Anyone can fork the repo, make their own changes, compile their own version, and even submit a pull request to possibly get their changes incorporated into a future release. The rest of this post describes how to get started with hacking the Force.com CLI.
Environment Set Up
There are a few prerequisites to fulfill before you can fork your own repo.
- Have a GitHub account and have Git installed on your computer. If you do not have this, I highly recommend Jesse Altman’s excellent Intro to Git article as a guide.
- Make sure that you have The Go Programming Language installed. If it isn’t, follow these instructions to install it.
- Make sure that you have Mercurial installed. If it isn’t, follow these instructions to install it.
Make sure that git, hg (mercurial), and go are on your PATH.
Once you have all of the development tools installed and your GitHub account set up, you can fork the repo. After forking it you will have your own repo. At that point, you can follow the Hacking Instructions to download the source and all of its dependencies, but instead of using github.com/heroku/force you’ll use the repo that was created from the fork (i.e., github.com/yourGitHubUserName/force).
Once you compile you will have a force executable that you can use. You can make changes to your source code and recompile. Eventually you may even feel like you have something that you can contribute (follow these steps).
You can also hack on your own without forking. You just wouldn’t be able to commit back any changes. To do that, simply follow the Hacking Instructions and use the github.com/heroku/force value as it is in the instructions.