February 2015

Gavin Pickin

CommandBox Roadshow - Episode 3 - Building Custom Commands - with ME

Apache, CFML Language, CFML Server, CommandBox, Lucee, Online Interactive Learning

I have been playing with Ortus Solution's amazing new tool CommandBox a lot lately. After a couple of posts on my blog, Brad Wood from Ortus Solutions reached out to me and asked if I would be interested in sharing what I have been doing with the community. A lot of time and money was invested by Ortus Solutions to make this product, and every knows ColdFusion / CFML in general needed something like this for a long time now, so of course I accepted their offer. I have already posted a couple of blog posts on the Ortus blog (links below), and today we recorded an episode of the CommandBox Roadshow, with yours truly in charge of the Adobe Connect session.

It was one of those mornings so we didn't get the blog posts, emails and tweets out there in time to get a big audience, but we recorded the session, so please check it out, the link is below.


I walked through some of the features of my kiwiSays command, and even I learned a couple of things from Brad while recording. I didn't know that the "r" command reloaded CommandBox, so as you develop, you can quickly reload, so you can test as you go. I was closing my terminal and reopening it, which isn't efficient, but after working with Cordova, and XCode, and IOS lately, I am used to not being efficient :)

I mentioned the "CommandBox - Commands can be clean code too" post from Ortus where I took my monolith Run function from the addWebsite command, and made it "CLEAN" by refactoring into smaller functions. We looked at how you can have namespaces (or groups of commands) and how you can save settings in a json object, and how one command can call other functions.

I also walked you through how to build your own command, and in the BOX spirit, I called this one BoximusPrimeSays, If you want to open your default browser, commandbox comes with a browse command already, and that is pretty slick. I wanted to go further and open different browsers. So we made a couple of smaller commands, to pass a url to Firefox, or Chrome, or Safari. To make it really useful, we made a "boximusPrimeSays open" command, which opens MULTIPLE browsers all to the same url, from a simple command. I hope you take the time to make a command yourself, and see how easy and powerful CommandBox is.

CommandBox is a great Package Manager, and REPL, but Commands make it a tool that we all can use... hope you make some and share them with the community too.

Blog Search