Autocompletion for Bash CLI

If you haven’t yet read the article on Bash CLI then go read it now.

Bash’s ability to automatically provide suggested completions to a command by pressing the Tab key is one of its most useful features. It makes navigating complex command lines trivially simple, however it’s generally not something we see that often.

Bash CLI was designed with the intention of making it as easy as possible to build a command line tool with a great user experience. Giving our users the ability to use autocompletion would be great, but we don’t want to make it any more difficult for developers to build their command lines.

Thankfully, Bash CLI’s architecture makes adding basic autocomplete possible without changing our developer-facing API (always a good thing).

Read more »

Building a CLI in Bash

If you’re just looking to hop straight to the final project, you’ll want to check out SierraSoftworks/bash-cli on GitHub.

Anybody who has worked in the ops space as probably built up a veritable library of scripts which they use to manage everything from deployments to brewing you coffee.

Unfortunately, this tends to make finding the script you’re after and its usage information a pain, you’ll either end up grep-ing a README file, or praying that the script has a help feature built in.

Neither approach is conducive to a productive workflow for you or those who will (inevitably) replace you. Even if you do end up adding help functionality to all your scripts, it’s probably a rather significant chunk of your script code that is dedicated to docs…

After a project I was working on started reaching that point, I decided to put together a tool which should help minimize both the development workload around building well documented scripts, as well as the usage complexity related to them.

Read more »