From: Alex Shulgin Date: 2008-03-26T04:30:08+09:00 Subject: Re: optionparser to gui automation? On Mar 24, 7:07 pm, Mark Noworolski wrote: > [Note: parts of this message were removed to make it a legal post.] > > I'm looking to support functionality like follows: > 1. You start a ruby program with commandline arguments (in a standard > optionparser kind of way)... > 2. If you do not provide any, a GUI pops up, asking you for things that > would otherwise be on the commandline. > 3. Ideally, this is automated with semi-sane defaults for the gui view. > > I would expect that there might be some sort of optionparser extension that > might do this but googling has not helped me out so far... > > Does anybody know of anything like this? Hi, A while ago, I had been trying to do something similar, but not exactly. :-) I've looked at this at a different angle: let's say we have some command-line utility with lots of options and we'd like to provide a GUI. My idea was that as we can simply map GUI elements into command line parameters, we can have a parser to read parameters from command line and fill the GUI. I've implemented a bit of this for my gtk-fortune project back while. You might be interested to check out these: http://gtk-fortune.rubyforge.org/svn/trunk/ http://gtk-fortune.rubyforge.org/svn/trunk/cmdgui The relevant code is only in the trunk as I think it's still not in a shape for a release or separate project and I hadn't touched it in quite a while... Please note, that in my approach I assumed that GUI is hand-made, not generated, as this allows for "rich" options dialogs like "disable that input field if this checkbox is cleared", etc. Nonetheless, it should work with a generated GUI as well. ;-) Also, I've used my own limited command-line parser--it should be possible to replace it with some widely used one. -- Regards, Alex