At long last (years) I knuckled down and made a simple xmlsh GUI. This will be in the next release.
Why ? I have been opposing this for a long time for many reasons, the least of which is I dont really like writing GUI's. But I got tired of the limited editing capabilities of DOS command shells and enjoy the very simple BSH UI GUI ...
I think what stopped me for long is the slippery slope. Once you start with a GUI where do you stop ? Xmlsh is a command line shell and a embedded API, not a WYSIWYG tool.
But alas ... a simple GUI is useful sometimes. I played around with various toolkits and settled on using plain AWT and Swing. I found that Eclipse Windows Builder supports simple AWT apps. Quite a nice tool. I tried SWT but while it is much more feature full, it is very much tied to Eclipse and required a dozen more jar files to run even a basic window. With AWT I was able to do a functional GUI in 200 lines of code. This will likely expand to 20000 ... as feature creep sets in, but its a start.
Here is a screenshot of a sample session "xmlshui"
Of course now that I've started there is so much to think about! The first major barrier of thought is should the GUI act like a script or terminal ?
ReplyDeleteThere is little difference ... its subtle as the same thing you would type into a interactive terminal command line works identically in a script. The difference is state.
In a terminal session the current shell maintains state over each invocation. In a script each script is run in its own shell.
so in the GUI ... I first started as a terminal and when you hit enter it would try to run the command line. But one advantage over a terminal is that a GUI lets you enter and edit multi line statements so I tried what is shown above with a "run" button. Enter doesnt invoke anything. Its more like editing a script and running it.
But it still can be both ways. Should the state of a previous run be carried over ? That is if I first run
A=1
then run
echo $A
should the value of $A be set or unset ?
Under the hood this means the difference between launching a new shell for each run, or reusing the same one.
Inquiring minds want to know !