CommandBox : CLI, Package Manager, REPL & More
6.0.0
6.0.0
  • Introduction
  • About This Book
  • Authors
  • Overview
  • Release History
    • 6.x Versions
      • What's New in 6.0.0
    • 5.x Versions
      • What's New in 5.9.1
      • What's New in 5.9.0
      • What's New in 5.8.0
      • What's New in 5.7.0
      • What's New in 5.6.0
      • What's New in 5.5.2
      • What's New in 5.5.1
      • What's New in 5.4.2
      • What's New in 5.4.1
      • What's New in 5.4.0
      • What's New in 5.3.1
      • What's New in 5.3.0
      • What's New in 5.2.1
      • What's New in 5.2.0
      • What's New in 5.1.1
      • What's New in 5.1.0
      • What's New in 5.0.0
    • 4.x Versions
      • What's new in 4.8.0
      • What's New in 4.7.0
      • What's New in 4.6.0
      • What's New in 4.5.0
      • What's New in 4.4.0
      • What's New in 4.3.0
      • What's New in 4.2.0
      • What's New in 4.1.0
      • What's New in 4.0.0
    • 3.x Versions
      • What's New in 3.9.0
      • What's New in 3.8.0
      • What's New in 3.7.0
      • What's New in 3.6.0
      • What's New in 3.5.0
      • What's New in 3.4.0
      • What's New in 3.3.0
      • What's New in 3.2.0
      • What's New in 3.1.1
      • What's New in 3.0.1
      • What's New in 3.0.0
    • 2.x Versions
      • What's New in 2.2.0
      • What's New in 2.1.1
      • What's New in 2.1.0
      • What's New in 2.0.0
    • 1.x Versions
      • What's in 1.0.0
  • Getting Started Guide
  • Setup
    • Requirements
    • Download
    • Installation
    • Light and Thin Binaries
    • Non-Oracle JREs
    • Upgrading
    • Common Errors
  • Usage
    • Execution
      • Recipes
      • CFML Files
        • Using a DB in CFML scripts
      • OS Binaries
      • CFML Functions
      • Exit Codes
    • Commands
    • Parameters
      • Escaping Special Characters
      • File Paths
      • Globbing Patterns
      • Piping into Commands
      • Expressions
    • Command Help
    • Environment Variables
    • System Settings
    • System Setting Expansion Namespaces
    • Ad-hoc Command Aliases
    • Default Command Parameters
    • REPL
    • Tab Completion
    • Interactive Shell Features
    • forEach Command
    • watch Command
    • jq Command
    • printTable Command
    • sql Command
    • Auto Update Checks
    • Bullet Train Prompt
    • 256 Color Support
    • A Little Fun
  • IDE Integrations
    • Sublime Text
    • Visual Studio Code
  • Config Settings
    • Module Settings
    • Proxy Settings
    • Endpoint Settings
    • Server Settings
    • JSON Settings
    • Misc Settings
    • Task Runner Settings
    • Setting Sync
    • Env Var Overrides
  • Embedded Server
    • Multi-Site Support
      • Defining Sites
      • Configuring Sites
      • Servlet Pass Predicate
      • Bindings
      • Multi-Site Examples
      • Pretty Diagrams
    • Multi-Engine Support
    • ModCFML Support
    • Server Versions
    • Start HTML Server
    • Offline Server Starts
    • Debugging Server Starts
    • Server Processes
    • Manage Servers
    • FusionReactor
    • Server Logs
    • Server Scripts
    • Configuring Your Server
      • Security
        • Basic Authentication
        • Client Cert Authentication
      • Server Profiles
      • Server Rules
        • Baked in Rules
        • Allowed Static Files
        • Rule Language
        • Rewrites Map
        • Custom Predicates/Handlers
        • Rule Examples
        • Debugging Server Rules
      • Bindings
        • Open Browser URL
        • Legacy Port & Host syntax
        • Legacy SSL Server Cert syntax
        • Legacy SSL Client Cert syntax
      • Proxy IP
      • HTTPS Redirect/HSTS
      • SSL Client Certs
      • URL Rewrites
      • Aliases
      • Custom Error Pages
      • MIME Types
      • Welcome Files
      • Custom Java Version
      • Adding Custom Libs
      • GZip Compression
      • REST Servlet
      • Performance Tuning
      • Undertow Options
      • Custom Tray Menus
      • JVM Args
      • Case Sensitivity of Web Server
      • Ad-hoc Env Vars
      • Ad-Hoc Java System Properties
      • server.json Env Var overrides
      • Server Home
      • web.xml Overrides
      • Console Log Layout
      • Resource Manager
      • Adobe CF Features
      • Experimental Features
    • External Web Server
    • Starting as a Service
    • Single Server Mode
    • Server.json
      • Working with server.json
      • Packaging Your Server
      • Using Multiple server.json Files
  • Package Management
    • Installing Packages
      • Installation Path
      • Installation Options
      • Advanced Installation
      • Debug Installation
    • Private Packages
    • System Modules
    • Code Endpoints
      • ForgeBox
      • HTTP(S)
      • File
      • Folder
      • Git
      • Java
      • S3
      • CFLib
      • Jar (via HTTP)
      • Lex (via HTTP or File)
      • Gist
    • Package Scripts
    • Dependencies
    • Semantic Versioning
    • Updating Packages
    • Creating Packages
      • Editing Package Properties
      • Publishing Lucee Extensions to ForgeBox
    • Artifacts
    • Box.json
      • Basic Package Data
      • Extended Package Data
      • Package URLs
      • Installation
      • Embedded Server
      • Dependencies
      • TestBox
    • Managing Version
  • Task Runners
    • Task Anatomy
    • BaseTask Super Class
    • Task Target Dependencies
    • Passing Parameters
    • Using Parameters
    • Task Output
      • Printing tables
      • Printing Columns
      • Printing Tree
    • Lifecycle Events
    • Threading/Async
    • Task Interactivity
    • Shell Integration
    • Downloading Files
    • Running Other Commands
    • Error Handling
    • Hitting Your Database
    • Sending E-mail
    • Interactive Jobs
    • Watchers
    • Property Files
    • Running other Tasks
    • Loading Ad hoc Jars
    • Loading Ad-hoc Modules
    • Cancel Long Tasks
    • Progress Bar
    • Installing Lucee Extensions
    • Caching Task Runners
  • Helpful Commands
    • Token Replacements
    • Checksums
    • Code Quality Tools
    • ask and confirm
  • Deploying CommandBox
    • Github Actions
    • Docker
    • Heroku
    • Amazon Lightsail
  • TestBox Integration
    • Test Runner
    • Test Watcher
  • Developing For CommandBox
    • Modules
      • Installation and Locations
      • Configuration
        • Public Properties
        • Configure() Method
        • Lifecycle Methods
      • Conventions
      • User Settings
      • Linking Modules
    • Commands
      • Aliases
      • Using Parameters
        • Using File Globs
        • Dynamic Parameters
      • Command Output
      • Tab Completion & Help
      • Interactivity
      • Watchers
      • Shell integration
      • Running Other Commands
      • Error handling
      • Watchers
      • Loading Ad hoc Jars
    • Interceptors
      • Core Interception Points
        • CLI Lifecycle
        • Command Execution Lifecycle
        • Module Lifecycle
        • Server Lifecycle
        • Error Handling
        • Package Lifecycle
      • Custom Interception Points
    • Injection DSL
    • Example Project
    • FusionReactor for the CLI
  • ForgeBox Enterprise
    • Introduction
    • Storage
    • Commands
      • List
      • Register
      • Login
      • Set Default
      • Remove
    • Usage
Powered by GitBook
On this page
  • Random Fixes
  • Random New Features
  • Improvements to Native Binaries
  • Better Exit Code handling
  • Command Chaining
  • &&
  • ||
  • ;
  • New Assertion Commands
  • New S3 Endpoint for Installing Packages
  • Updated Server Tray Menus
  • Release Notes
  • Bug
  • New Feature
  • Improvement

Was this helpful?

Edit on GitHub
Export as PDF
  1. Release History
  2. 4.x Versions

What's New in 4.2.0

PreviousWhat's New in 4.3.0NextWhat's New in 4.1.0

Was this helpful?

Random Fixes

In no particular order...

  • Fix background colors not showing up in Powershell and Windows cmd

  • System Setting expansions not always working in server.json

  • testbox run no longer blindly assumes you're returning JSON.

  • Piping commands into box was broken since 4.0.0

  • Starting server with --debug didn't output logs on error.

Random New Features

Sorted by createUUID() DESC...

  • Custom commands have more control over their tab completion candidates.

  • Control how many levels deep package list displays

  • New versions of Lucee, JGit, JLine, and WireBox

  • More pack200 of the Lucee jar (and more improvements to come soon in the next version of Lucee)

  • Automatic detection for build servers like Travis-CI to hide progress bar animations.

  • Cloning Git repos during install has a nice new progress bar that plays well with

  • You can use the aforementioned progress bar for your own purposes in custom commands and Task Runners.

Improvements to Native Binaries

The run command has been a pain over the last few versions as every "fix" has seemed to lead to another regression. We've made some more changes to try and get each use case working as expected with no annoying bash messages about "job control". Fingers crossed.

Single one-off command, streams output to console as it comes.

!ping google.com

Piping output of native binary into another Command (output captured all together and not streamed).

!pwd | #listLast /

Running interactive commands. No output at all really, standard input and output of CommandBox bound directly to native shell

!nano index.cfm

Better Exit Code handling

You can now control the exit code that CommandBox (or your recipe) exits with. Remember, zero is successful, any other number is failure.

exit 123

Access the Exit Code of the previous command via a System Setting expansion of${exitCode}.

echo ${exitCode}

Recipes now have better support for exit codes. If a command throws an error OR returns a non-zero exit code, the recipe will stop and the exit code of the last command will be returned as the exit code from the recipe command. And if it was a non-interactive shell, the exit code will flow all the way back to the operating system from the box binary. Also, running "exit" inside of a recipe will no longer exit the entire shell, but just that recipe execution. This give you a lot better control over your recipes.

Command Chaining

Let's take a moment to review an existing but little known feature of CommandBox that we borrowed from bash. This is not new, but you need to know this for the following section to make any sense. Similar to bash, CommandBox allows you to chain multiple commands together on the same line and make them conditional on whether the previous command was successful or not.

&&

You can use && to run the second command only if the previous one succeeded.

mkdir foo && cd foo

||

You can use || to run the second command only if the previous one failed.

mkdir foo || echo "I couldn't create the directory"

;

You can use a single semicolon (;) to separate commands and each command will run regardless of the success or failure of the previous command.

mkdir foo; echo "I always run"

New Assertion Commands

With the above building blocks, we can get clever to create simple conditionals to only run commands if a condition is met. Or these can simply be used to cause recipes to stop execution or to fail builds based on a condition. The following commands output nothing, but they return an appropriate exit code based on their inputs.

pathExists

Returns a passing (0) or failing (1) exit code whether the path exists.

# Only run the package show command if the box.json file exists
pathExists box.json && package show

You can specify if the path needs to be a file or a folder.

# output server.json only if it exists
pathExists --file server.json && server show

# Create the dir foo only if it doesn't already exist
pathExists --directory foo || mkdir foo

assertTrue

Returns a passing (0) or failing (1) exit code whether truthy parameter passed. Truthy values are "yes", "true" and positive integers. All other values are considered falsy

# If this package is private, then run a package script
assertTrue `package show private` && run-script foo

# If this env var is true, then run a command
assertTrue ${ENABLE_DOOM} && run-doom

# Use the boolean output of a native CFML function to control this echo
assertTrue `#fileExists foo.txt` && echo "it's there!"

assertEqual

Returns a passing (0) or failing (1) exit code whether both parameters match. Comparison is case insensitive.

# If the name of our package isn't a specific string, only then set it
assertEqual `package show name` "My Package" || package set name="My Package"

# If this env var is the string "production", then perform a production install of dependencies
assertEqual ${ENVIRONMENT} production && install --production

New S3 Endpoint for Installing Packages

Big thanks to John Berquist and Dominic Watson for helping add this new feature. You can now install packages directly from S3, Amazon S3, Digital Ocean Spaces and Google Disk.

install s3://my-private-bucket/myPackage.zip

There are several different authentications mechanisms available too:

  • Per bucket credentials in your CommandBox endpoint settings

  • Global credentials in your CommandBox endpoint settings

  • Environment variables

  • AWS credentials file

  • IAM role

The full docs are here:

Updated Server Tray Menus

We've added 17 pieces of flair to our server tray menus to show you more information such as PID, webroot, and port as well as a new option to open up the web root in your file system explorer.

Release Notes

Here's the full list of everything that changed in CommandBox 4.2.0.

Bug

New Feature

Improvement

[] - .zip files in artifacts cache don't include empty folders

[] - "bash: no job control in this shell" error message (pull request)

[] - external commands/shells that are interactive (such as vi) are not working when executed from commandBox

[] - tab hinting colors wrong in PowerShell terminals.

[] - System settings not always used in server.json

[] - "testbox run" formats outputfile as JSON even if it's not

[] - Piping input to CommandBox broken

[] - Bleeding edge upgrades show wrong URL after S3 artifacts move

[] - --debug doesn't dump job logs on error

[] - Allow arbitrary command params to have file/folder completion via annotation

[] - Allow custom completion UDFs to provide group and description

[] - New conditional commands pathExists, assertTrue and assertEqual

[] - Allow access to previous exitCode as system setting

[] - Allow user to exit shell with specific exit code

[] - Improve recipe handling of exitCodes

[] - Compact package listing

[] - Write a custom JGit progress updater that clears out at the end

[] - Hide JLine warning about dumb terminals

[] - S3 Endpoint

[] - Upgrade to JGit 5.0.1

[] - Upgrade to Launch4J 3.12

[] - Skip forgebox checks on server start with server home dir that's already installed.

[] - Upgrade to JLine 3.8.2

[] - Pack200 Lucee bundles

[] - Upgrade to Lucee 5.2.8.50

[] - Default rewrites support /pms servlet used for Adobe CF 2018 performance monitor

[] - Default nonInteractiveShell setting in commonly known build environments

[] - Improve messaging when initting private package

[] - Reorganize the tray menus

[] - Upgrade to Wirebox 5.1

Docs Here
Docs Here
interactive jobs
Docs Here
https://commandbox.ortusbooks.com/usage/execution/exit-codes
https://commandbox.ortusbooks.com/usage/execution/exit-codes#assertions
https://commandbox.ortusbooks.com/package-management/code-endpoints/s3
COMMANDBOX-417
COMMANDBOX-808
COMMANDBOX-809
COMMANDBOX-810
COMMANDBOX-811
COMMANDBOX-829
COMMANDBOX-833
COMMANDBOX-834
COMMANDBOX-835
COMMANDBOX-814
COMMANDBOX-815
COMMANDBOX-839
COMMANDBOX-840
COMMANDBOX-841
COMMANDBOX-842
COMMANDBOX-746
COMMANDBOX-779
COMMANDBOX-813
COMMANDBOX-817
COMMANDBOX-818
COMMANDBOX-819
COMMANDBOX-820
COMMANDBOX-821
COMMANDBOX-823
COMMANDBOX-825
COMMANDBOX-826
COMMANDBOX-827
COMMANDBOX-828
COMMANDBOX-837
COMMANDBOX-843