[Zope] [ANN] ZShell 0.2

Jerome Alet alet@unice.fr
Mon, 7 May 2001 09:17:17 +0200 (MET DST)

On Mon, 7 May 2001, Jason Cunliffe wrote:

> Jerome Alet" <alet@unice.fr> wrote:
> > If you're interested I've put a 0.3 online at:
> >
> > http://cortex.unice.fr/~jerome/zshell/
> This gets better all the time :-)
> I have learned so much already, just looking through your source.
> It makes a great Zope tutorial in unexpected ways. Thanks.

This was also unexpected !

> > new commands: mkver, enter, leave, save, discard (versions)
> > and the powerful but not used at its full power until
> > variables are checked in: the "call" command !
> >
> > there are also many bug fixes and the possibility to
> > call the method with a zshellscript argument containing the
> > list of commands to execute.
> Can you give an example to do this please.

just do something like:

	  <dtml-let result="zshell(_, zshellscript=["mkdir foo/bar"])">
	    <dtml-if "result == 0">
	      All worked fine
              An error occured

When called like that, it returns only the status code of the result:
	    0 = no error
	other = errors occured

> I keep hitting return and expecting my code to happen. It's not just
> laziness.
> The RUN button breaks the familiar shell command line paradigm.
> I realise it is nice to have multiple lines, but I find it faster to type
> and keep typing, than have to jump back and forth to the mouse.
> One solution:
> SHIFT + ENTER => multiline entry
> ENTER         => execute

Don't know how to do it, but this will probably need some javascript at
which my value is 0 or less. If someone can help...
NB: I want it to also work fine with Lynx.

> -----------------------------
> At the top of the page include all the zshell commands as hyperlinks
> Clicking on a command displays the docstring for the command above/below the
> text area
> and also enters the comand and dummy argument string directly into the
> Zshell shell where one may edit.

Again will probably at least partially need some javascript.

> Add a new tag so that Zshell commands can be run from DTML

Interestingly we want the same things :-)
Not in my priority list, but definitively needed.

> Normal shell would return the results in the shell itself.
> I can see why in Zope this may not be often such a good idea. For example,
> making ls return a hypelinked table as you do is terrific idea.

The new version will support at least partially pseudo standard I/O
streams stdin, stdout, and stderr which contents will be retrievable.
This is a necessity for piping anyway. The HTML result will be another
retrievable I/O stream. I think in the future zshell will return an
instance of the class I define.

The code is in heavy lifting right now, so don't expect a new version

> 4. cd
> Seems a little inconsistent at the moment partly becuase it does not resolve
> "/"
> I have a zshell in zope root "/"

it's better with every version, but still not perfect. My toObject()
method sucks great.

> Perhaps you disagree..

not at all, but I was unable to write something decent.

> Also for any CD command which is not valid, I suggest including a 'pwd' by
> default in the first line of the Results error message:


> mkdir a/b/c/d -(p)ublic -(u)ser
> possibly:
> :set public+user attributes for all new folders
> :set public+user attributes for just the last folder
> Perhaps control it using a simple binary flag style. For example:
> mkdir a/b/c/d -p0110 -u1110
> Set 'public' b and c only
> Add 'user' folders in  a,b,c only

not very user friendly IMHO, but at least solves the problem in an elegant

-p and -u will have to be the first parameters since mkdir accepts
multiple arguments.

> 6.  cp
> Of course 'cp' should work across folders and also be able to paste in one
> line.


> 9. wildcards
> Some useful, obvious ones for ZopeShell wishlist whcih might be much easier
> I can think of:
> *
> *meta
> *date

no because *'s semantic MUST mean: any object id which ends in meta,
date, etc...
if we want to be consistent with the shell normal behavior

> 8. wget
> Very useful for all kinds of things
> Change the 'fname' code so that the default behavior is to save names under
> their original source names.
> If that id is already taken, then take action and rename.

ok, but . in ids is not a good idea in Zope/Python.

> Include an flag for Zope wget to do auto renaming [like it is now].
> syntax could perhaps be:
> wget args rename_meta    # rename to append meta tag
> wget args rename_sub     # rename to append subtype
> wget args rename_xyz     # rename to apend _xyz
>                          # where _xyz are any continuous suffix string,
> "_bak" etc.

I don't like it.

> 7. adduser
> This is going to be very cool but, meanwhile I am not not clear what to 'do'
> with adduser.

add many user in one line.

> At least until there is a Zshell mechanism to get and set permissions, and

will come soon.

bye, and thanks for your support.

PS: perhaps I should set up a mailing list somewhere to not waste Zope's
one bandwidth, what do you think ?

Jerome Alet