Micro Utilities

Recently I’ve created a tiny site called tool.haus. It’s a repository for all the small utilities I write from now on.

On that note, I thought about the API that these little utilities should expose.

Most bash scripts or utilities use command line arguments to define behavior. This is great for humans but can be a pain when calling scripts from other scripts.

My current strategy is to implement the same API in all scripts:

JSON -> STDIN

Debug output -> STDERR

JSON -> STDOUT

All options, flags and input data are encompassed in the input JSON. Likewise, all output is exposed as JSON. Human-readable output is sent to STDERR.

We’ll see if this utility convention works out!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s