Choosing a Command Line Framework for CLI Property

by Kirsten Hunter
388

A major driving force throughout the creation and ongoing development of our CLI suite—including CLI Property, among other tools—has been the desire to achieve superior usability. We know that our customers need to work with Akamai APIs to integrate our platform into their processes, so every choice we make is carefully considered to see how it will affect the user experience.

With CLI Property in particular, some of the commands have become fairly complicated over time, with lots of options and flags. We wanted to improve that user experience, so it became apparent that some thought needed to go into the usage for the command to help users navigate through their choices and get the most out of the tool.

After looking at some very respectable command line framework choices such as commander and yargs, we stumbled upon sywac, a highly configurable command line processor supporting all the interface options we required (plus a few we haven’t yet needed). While the documentation for this system is still under construction, the author of the library—in true open source fashion—went above and beyond to help get everything working correctly.

As an example, here’s an image of the “akamai property modify help” output, including several groups and example formatting:

After looking at the three CLI framework options, here are a few top-level observations:

  • Commander didn’t allow for color configuration or grouping of options in the way I needed; many of our commands are very complicated, as you can see here.  
  • Yargs didn’t support our standard help format of ‘akamai property help modify.’  
  • Sywac is pretty complicated but incredibly powerful, supporting just about anything you’d want to do with your node-based commands.

Ultimately, I chose to go with sywac due to its excellent power and configurability. Let me know what you think, or if your experience with any of these frameworks was different from mine.

More good news about CLI Property

CLI Property has also been updated with several new features, based on user feedback. You can now get a list of groups, or use ‘modify’ to change the cpcode for your property.  We’re always on the lookout for new ways to improve CLI Property and indeed any of the CLI suite of tools.  So please let us know when you think of functionality we could add to improve your experience.

As a final note, you can now get the base CLI Property binary using NPM install, so if you’re already coding in Node you don’t need to download from your browser. If you’ve got NPM on your system, you can install with:

npm install -g akamai-cli

Kirsten Hunter is an API Evangelist at Akamai Technologies.

Categories: DevOps, Technology

Suggested Article