Hi, I finally got around to playing with ZShell (after all those emails announcing it on the list) and its cool, thanks Jerome. 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 ZShellCLI: A CLI to ZShell
open Connected to http://127.0.0.1 127.0.0.1> pack 7 Done "pack 7"
Open a server, type your command, its executed through ZShell by xml-rpc and so on. The coolest part about this could be access to local tools "vim standard_html_header" (one day) for example... Anyway questions (mostly to Jerome): - Is this useful to anyone else? - Any plans to make it a product, then I could call the methods directly? Plus more support like changing directories.. - 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...? Thanks Jerome, good product and thanks for helping out the community. Cheers -- Andy McKay
Andy McKay wrote:
Open a server, type your command, its executed through ZShell by xml-rpc and so on. The coolest part about this could be access to local tools "vim standard_html_header" (one day) for example...
Anyway questions (mostly to Jerome): - Is this useful to anyone else?
OH MY GOD YES. Andy, will you *please* release this as soon as you've got something even trivially useful?
- Any plans to make it a product, then I could call the methods directly? Plus more support like changing directories..
Yes please!! I might be able to help some once you get rolling, I've got some zope / python experience and I can write a tolerable shell script... --PW
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
Is it available somewhere ?
Its thrown up on http://www.zope.org/Members/andym/ZShellCLI. Please note it may not work and needs some hacking, a custom version of zshell, plus xmlrpclib access. Works for me and the best commands to play with? ls and cd work great!
Yes, this is planned for the 2.0 release.
Yeah.
However I've never made any python Zope product yet, only ZClasses, so any help is welcome.
I'd like to help, but I have so many other projects to work on, I cant promise much...
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.
Well yeah I got cd working, but you can see the hoops to jump through. Since you pass the folder through as a hidden form, meaning I would have to parse the html each time to get that value. Hence my hacked version of zshell, that returns a dict of value, and path. I think you'll see the problems with using the current style of only exposing one method when you look at the code...
Yes. It should work just now by calling get_stdout() and get_stderr().
Aha! Yep use get_stdout(), but it doesnt always work. Get lots of %s. :) Anyway ls and cd work great!
bye, but I'll only thank you when I'll be able to download ZShellCLI.py ;-)
Cheers -- Andy McKay
On Tue, 12 Jun 2001, Andy wrote:
Aha! Yep use get_stdout(), but it doesnt always work. Get lots of %s. :)
probably because you've fucked line 685 of your own version of zshell. it should read: self.printf("%s" % msg) instead of: self.printf("%s") but this line is not in the original ZShell, which was a voluntary action on my part, as I've said before: "keep it quiet" so each run_something method of ZShell should call self.printf() only when needed, it's the case IIRC in at least pwd, ls, find. I'll try to test ZShellCLI ASAP.
bye, but I'll only thank you when I'll be able to download ZShellCLI.py ;-)
So: Thanks a lot !!! bye, Jerome Alet
"Andy McKay" <andym@ActiveState.com> wrote:
E:\Zope23>bin\python ZShellCLI.py
ZShellCLI: A CLI to ZShell
open Connected to http://127.0.0.1 127.0.0.1> pack 7 Done "pack 7"
Open a server, type your command, its executed through ZShell by xml-rpc and so on. The coolest part about this could be access to local tools "vim standard_html_header" (one day) for example...
Anyway questions (mostly to Jerome): - Is this useful to anyone else?
YES !! This is a great adddition to a great tool. imho ZShell opens up Zope in really powerful understandable ways to a much wider developer audience +quickly. It has many merits in its own rightsand over time will hopefully interface with other components in even more exciting and useful ways. My favorite ZShell wishlist items: .zsh .zrc I hope you post ZShellCLI.py and can help Jerome to resolve any ZShell Productizing hurdles. best wishes ./Jason
participants (5)
-
Andy -
Andy McKay -
Jason Cunliffe -
Jerome Alet -
Paul Winkler