Major Revisions to the Box CLI Now Available in v2 Release.

Jonathan LeBlanc
Box Developer Blog
Published in
2 min readDec 21, 2018
CLI V2 Fetch File Collaborations Example

We’re happy to announce a major update to the Box CLI with our recent v2 release. With this release we have included a number of major upgrades, bug fixes, and a new underlying open source CLI framework, oclif, that changes how the command structure functions.

To see this in practice, let’s look at a simple example to fetch the current user info in the old CLI version and the new version, to see how the command structure differs:

# Old Command Structure
box users get me
# New Command Structure
box users:get me

As you can see, colons are now employed to disambiguate commands from their arguments. This new architecture provides us with the ability to better structure (and differentiate) command and argument options, even when there are nested subcommands underneath a root command. The added benefit is that this allows us to shorten the length of the commands for performing actions.

Beyond the command structure changes and adoption of oclif, there are also a number of major upgrades:

  • Full API Parity: All available Box API endpoints are now available as commands and options within the CLI.
  • Recursive Folder Upload / Download: When uploading or downloading folders with a nested structures, that structure will now be preserved.
  • Custom API Calls: The new box request command will allow you to make calls to any Box API endpoint directly, allowing you to pass in arbitrary URLs and parameters.
  • Bulk Input / Output Updates: Every command can now accept its arguments and flags from a file input in either CSV or JSON format for bulk input. Bulk output commands no longer require the output to be written to disk, and can output JSON, CSV, or human-readable output directly to stdout or to any file.
  • User Friendly Prompts: Some commands (e.g. box configure:environments:select) can now be called without providing the necessary arguments, resulting in the command displaying a helpful prompt to allow you to select the argument value.
  • Command Autocomplete: Tab autocomplete can now be enabled easily through the CLI via the box autocomplete command.

Please see the v2 release notes for complete information on the changes to the Box CLI in this release.

For installer / getting started details, please see the developer documentation.

Happy CLI’ing!

--

--

Jonathan LeBlanc
Box Developer Blog

Emmy award winner, O'Reilly author, open source contributor, Senior Director of Developer Advocacy at Box.