
Daniel Selans
Batch.sh
Dan is a co-founder of Batch.sh, an APM platform for streaming data. Dan previously worked at InVisionApp, New Relic and before that, spent some time doing integration work at data centers. He has been writing Go for 6+ years, works primarily in backend, listens to a lot of black metal and prefers Stella's over IPA’s. He resides in Portland, Oregon but is originally from Latvia.
Crafting CLI Tools With Protobuf
How do you build a CLI tool with hundreds or thousands of flags, keep it easy to read and easy to maintain?
Sounds pretty rough but things get even more complicated if you have to expose the same options to another app. Now you’ll need to figure out how to keep the flags in-sync across multiple packages.
“Added a new flag to app A? Don’t forget to add it to app B and C!”
Thankfully, there is a way to solve this problem.
In this talk, I will show you how our team was able to use protobuf comments to dynamically generate complex CLI flags that were used across multiple apps and libraries.
This pattern has enabled us to keep our CLI options defined outside of code which improves readability, maintainability and most importantly, introduces a single source of truth.
Join me as I walk you through the pattern, show you how to design your protobuf messages, what to do and what not to do in order to end up with an elegant end result.