I rewrote the USB factory program that I've been talking about now in Rust based on my C PoC and the patterns for using io_uring while using it.
Reality hit and there's need to also talk to my program for managing things like USB hubs and ports, and images used as sources for them.
I first did JSON protocol yesterday, but it really makes the ad-hoc testing heavy. It's probably great when you have a product shipped and JSON is spoken by computers to each other but for human on terminal interaction it is a nightmare.
Today I found like ultimate solution for client-side of this: Clap. You need exactly one parser for a simple command-language, and then the commands that are typed are subcommands of that parser. And Clap has rich set of features what those contains.
Stuff coming back from program is still JSON (like listing of stuff) but since it is always data (vs not code + data) I will million great ways to fixup that part :-)
Definitely a trick to my hat of tricks that I will re-use also on other languages to get quickly ad-hoc command languages setup!
#rust #rustlang #clap