by crazydiamond · 16y ago · 0 comments
I had been actually thinking on the lines of how emacs can expose its commands -- although i am not an emacs user. I'd need to study that.
I am very familiar with various command line parsing libraries, including cmdparse. I did not get your requirement in this context. Thanks for answering.
I was wanting for something that lets me add commands, with aliasing, and arguments (maybe with optional regex validation) - e.g. breakpoint add $BEEF, etc. Writing a DSL is one solution and will probably end up being the way I go once I take a second iteration at this. Right now I'm just using regex parsing, but I only have a few commands I need to worry about now.
cmdparse is frustratingly close but makes a few assumptions that you want to parse ARGV or something that looks like it.
The current implementation is that I have a hardware instance (like a CPU) that I want to monitor. To do that, I create a new monitor object, and tell it to monitor the hardware instance, and the monitor will mix itself in from there. It's not good if extra methods show up in the global namespace just for command parsing within a single module of the app. The monitor is just a part of this application, and a part that will not be used often by most users.
Everything I see feels like it's inches from what I really need. So close yet so far :)
otoh, there are some simple ones you could possible customize: i once studied and modified Choice (by Chris Wainstrath).
I'd really like to know if you find something that helps you, or what you did eventually.