ofxAddonScript - To easily checkout ofxAddons for projects


OSX Bash command script to get specified openFrameworks addons

Work Collaboratively?
Using lots of openframeWorks addons or other git repositories for a project?
Now you can include this script with projects to make getting addons easier!

This script will help you by allowing you to choose addons to be cloned and checkout automatically if they don’t exist in a specified folder (default oF/addons).
If the user already has the repository checked out, it can pull the latest.



  • Supports custom folder names
  • Supports customised git remote addresses
  • Supports specific branches for repository
  • Supports specific SHA commit checkout

How to use:

By placing the addons.command in a project directory or addon directory you can easily specify addons to download automatically by getting the user to run the command.

Example usage:

Normal way using two parameters to master and latest commit

GetAddon "ofxAddonScript" "https://github.com/danoli3/ofxAddonScript.git"  

Advanced way using

GetAddon "ofxAddonScript" "https://github.com/danoli3/ofxAddonScript.git" "master" 

Advanced way using a specific SHA commit code (only use if you want a repo set to a specific commit).

GetAddon "ofxAddonScript" "https://github.com/danoli3/ofxAddonScript.git" "master" "78fd6f27cf82743644f0c12f926ae053a42a7aa3"

GetAddon Function Parameters

  • Param1: Addon folder name
  • Param2: Github address
  • Param3: Branch
  • Param4: SHA commit

Currently MacOSX bash script only.

Any Unix users want to give it a whirl?
For Windows users, work in progress to get this to work. I’m thinking running it within PowerShell.exe to get access to git commands and translate rest to batch (or unix style might work in PowerShell).

Just a small remark from a UI perspective - it does not make much sense to specify both a branch and an SHA hash. What would happen if the given SHA is not on the branch in question? What happens if the specified SHA is in the branch, but not at the tip? do you get the HEAD of the branch, or the SHA?

An SHA already uniquely identifies a commit, the branch is not necessary. What’s more, in git, branch names and SHAs can often be used interchangeably, i.e. for the same things. Therefore, I’d suggest that your script just accepts SHAs instead of branch names as the third parameter. You can check if the given argument names a branch, and if not, use it as an SHA (or just plain give it to git as-is).
A potential optimization I also did in ofStateManager is to check if a given SHA is currently at the HEAD of any branch, and if so, check out the branch by name instead. This way, you avoid unnecessarily “detached HEAD” situations.

Also, the name of your repo/script matches the rules for openframeworks addon naming (i.e. ofx***), but is not a valid OF addon. It might make sense to correct that. Failing that, you could inform the ofxaddons.com maintainers so they can update the blacklist of invalid addons.

Yeah you’re right! Thanks for the feedback I’ll change that for 1.3. I think we’ll definitely merge the branch param with the SHA like you said and have a git check if SHA is the current branch commit to stop that detached head ;D.

Yeah I wasn’t sure about the name so just went with what it is, a ofxAddon Script ;D
I didn’t think ofAddonScript was appropriate as that tends to be used only for core.
I also tend to only look for ofx when looking for openFrameworks ‘addons’ or related content as well so kinda of two minds about it. Open to name suggestions though.