Shelves CLI

So now I've got this little Node.js shelves CLI that I likely will never need again.

Ok, there's probably no need for this to exist, but here's the thing:

Since we've been stuck at home for three months, I've been doing small apartment projects that had been on the back-burner permanently. Things like organizing closets, tackling that drawer stuffed full of cables, and hanging shelves.

One of the last things on my current short-list was to hang some shelves in my home workspace. I didn't get pre-made shelves for this; instead I got four shelf brackets and two boards.

I wanted the end result to be two shelves evenly spaced up on my wall, and to do that, I needed to know where to affix the brackets to my wall.

This wouldn't be hard to calculate on paper, but I felt like writing some JavaScript.

So now I've got this little Node.js shelves CLI that I likely will never need again.

To run it, just pass in values for wall width, shelf width, shelf count, and padding between the edge of the shelf and the center of the bracket on both sides:

./index.js -w 82.5 -s 36 -c 2 -p 5

You'll get back an array of objects with bracket positions for each shelf, starting from the edge of the wall:

[ { '1': 8.5, '2': 34.5 }, { '1': 48, '2': 74 } ]

Surely you don't need this little CLI for hanging shelves, but if you do, I've put it up on GitHub.