CommandBox 5.3.1 Released

We’ve released a small update to our recent CommandBox 5.3.0 release. This contains fixes for a handful of regressions as well as a couple new features. You can access the new version on our Download page, our deb/rpm repos, or Homebrew.

And of course, you can find the latest docs and release notes here:

What’s New
Here’s a quick peek at the new items we’ve slipped into this release:

Updated bundled Java libraries

  • JLine - 3.19.0
  • jGit -
  • Launch4j - 3.14
  • JANSI - 2.3.2

Recursive jar scanning libDirs

When you configure libDirs for a server, CommandBox used to only load jar files found in the root. Now it will include sub directories which gives you more flexibility around how to install your jars.

# Jar installs to lib/jline-3.0.0.M1/jline-3.0.0.M1.jar
install "jar:"

# Load up the jar when the server starts
server set app.libDirs=lib

New printTable Command

In the previous release, we introduced a new helper for printing ASCII Art tables in your custom commands and task runners. We’ve taken this a step further and wrapped the table printer utiilty in a new command so you can use it from the CLI directly. We’ve also expanded its functionality to accept ANY data in as JSON and it will marshall it into a query for you. This means it can be a query, an array of structs, an array or arrays, and more. You can now get quick and easy visualization of any data right from the CLI or in builds.

# array of structs
printTable [{a:1,b:2},{a:3,b:4},{a:5,b:6}]

║ a │ b ║
║ 1 │ 2 ║
║ 3 │ 4 ║
║ 5 │ 6 ║

# array of arrays
printTable data=[[1,2],[3,4],[5,6]] headerNames=foo,bar

║ foo │ bar ║
║ 1   │ 2   ║
║ 3   │ 4   ║
║ 5   │ 6   ║

# Query object
#extensionlist | printTable name,version

║ name                                    │ version           ║
║ MySQL                                   │ 8.0.19            ║
║ Microsoft SQL Server (Vendor Microsoft) │ 6.5.4             ║
║ PostgreSQL                              │ 9.4.1212          ║
║ Ajax Extension                          │           ║

# JSON list of all servers
server list --json | printTable name,host,port,status

║ name                         │ host                        │ port  │ status  ║
║ servicetest                  │                   │ 54427 │ stopped ║
║ servicetest2                 │                   │ 52919 │ stopped ║
║ FRDemos                      │                   │ 50458 │ stopped ║

New sql command for on-the-fly manipulation of data

As if the previous command isn’t cool enough, we’ve also added a new “sql” command which will also accept any sort of data as JSON, marshall it into a query object and allow you to alias, filter, order, and limit the rows on the fly using CFML’s query of queries!

Filter, sort, limit, and select extensions installed into the CLI (output as table)

#extensionlist  | sql select=id,name where="name like '%sql%'" orderby=name limit=3 | printTable

Order and select JSON data from a file (output as JSON)

cat myfile.json | sql select=col1,col2 orderby=col2

Limit JSON (output as table)

sql data=[{a:1,b:2},{a:3,b:4},{a:5,b:6}] where="a > 1" | printTable

The sql command works very nicely with the new tablePrinter command, and truly makes JSON a first class citizen of the CommandBox CLI.

Small change to print.table() helper

We’ve made a small adjustment to the print.table() helper that was introduced in CommandBox 5.3.0 as follows. The old method signature is

public string function print(
	required any headers,
	array data=[],
	string includeHeaders        
) {

And the new method signature is:

public string function print(
	required any data=[],
	any includedHeaders="",
	any headerNames="",
	boolean debug=false
) {

The parameters to the new printTable command matches the NEW method signature of the print.table() helper as well.

Format XML in REPL

When working with XML in the REPL, formatting is now applied when the XML is printed out to the console, making it easier to read (same as JSON)

❯ repl "XMLParse( '<root><brad>wood</brad></root>' )"

<?xml version="1.0" encoding="utf-8"?><root>

Full release notes here:

Hi Bred,

When I run the command
server list --json | printTable name,host,port,status

I get this error:
\system\modules_app\server-commands\commands\server\list.cfc: line 115
113: // Process output
114: if( JSON ) {
115: print.line( servers.valueArray() );
116: } else {
117: servers.each( ( serverName, thisServerInfo ) => {
called from \system\services\CommandService.cfc: line 345
called from \system\services\CommandService.cfc: line 139
called from \system\Shell.cfc: line 787
called from \system\Shell.cfc: line 607
called from \system\Bootstrap.cfm: line 154

My version is v5.3.1+00392

Is ther something wrong with my installation?

Hi @Jeroen_Goorts that’s a known issue. The problem was I was testing on the Lucee 5.3.8 RC with hopes it would release prior to my CommandBox 5.3.1 release, however Lucee was dragging their feet so I rolled back to Lucee 5.3.7 right before I released, unaware that the structValueArray() function I had recently added to the server list --json command was brand new in Lucee 5.3.8. Well actually, not “brand new” at all- it was added nearly 7 months ago. Lucee 5.3.8 has just taken forever to go stable. At any rate, if you want to play with server list --json you can update to the CommandBox BE build or simply swap out the lucee jar in the CommandBox lib folder with the latest 5.3.8 jar from the Lucee download page.

1 Like