On Mon, 11 Jun 2001, Andy McKay wrote:
But I have to admit type command lines into a browser window doesn't thrill me. Typing command lines into standard cli however, does. So I started thinking that I could use the simple Cmd module in python, make calls using xmlrpc and... ZShellCLI, a command line interface was born... my quick proof of concept works like this:
E:\Zope23>bin\python ZShellCLI.py
Is it available somewhere ? This looks fantastic ! This should allow ZShell to behave like ZopeShell (http://www.zope.org/Members/sf/) now.
Anyway questions (mostly to Jerome): - Is this useful to anyone else?
In fact I've written it for fun. I don't have too much time left to use it (I prefer to write programs than to use them), but I know it is VERY powerful, especially the possibility to combine commands like 'find' (and soon others) with the --exec option, and the 'call' command (or other command) should allow near unlimited possibilities.
- Any plans to make it a product, then I could call the methods directly?
Yes, this is planned for the 2.0 release. This will include the possibility to create 'Script (ZShell)' objects which will behave just like 'Script (Python)' objects. But methods will still be callable directly (if possible, I don't know yet) However I've never made any python Zope product yet, only ZClasses, so any help is welcome.
Plus more support like changing directories..
What do you mean ? try the 'cd' command (or the 'man' command) you can also create them, delete them, or modify their permissions/properties. Maybe 'cd' doesn't work when called from xmlrpc, I don't know. The current working directory is preserved in an HTML hidden field, so maybe the problem is there.
- I cheated, I cant show return results, because everything comes back in html. (As a proof it works I open the results in a browser :) If it was a product, or there was a html / text option that would be great. I could parse everything through a html stripper, but that seems rather daft. Any chance we could get around this...?
Yes. It should work just now by calling get_stdout() and get_stderr(). However you should keep in mind that stdout doesn't contain the very same output that the HTML output does: it's simpler and often there's nothing at all, because I've tried to respect the Unix 'keep quiet' way of doing things.
Thanks Jerome, good product and thanks for helping out the community.
All the pleasure is for me. bye, but I'll only thank you when I'll be able to download ZShellCLI.py ;-) -- Jerome Alet