[Zope] [ANN] ZShell 0.2
Jason Cunliffe
jasonic@nomadicsltd.com
Mon, 7 May 2001 00:53:33 -0400
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.
> 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.
....................................
More wishlist suggestions for Zshell.
<note>
I aplologize only a little for this experiment in blatant featuritis. In
many cases this is not rocketscience, but a apprades to be a matter of
writing smart user-friendly wrappers around known zope tricks. The shell
paradigm is very good and does nto really interfere with the nature of zope.
Perhaps those with deeoper zen than me will see the catch. I beleive many of
the practical workflow headaches of using Zope among different
people[skills], can be solved by growing the Zope shell. It separates
function from syntax in a very simple way.
Logic is another question...
If nothing else, I suspect zopeshell is more concise, and readable to more
people out of the box. Also very extendable. A fascinating and useful
experiment imho.
</note>
---------------------------
1. MORE SHELL-LIKE BEHAVIOR
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
-----------------------------
2. ZSHELL DTML UI SUGGESTIONS
At the top of the page include all the wget commands as hyperlinks links.
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.
A checkbox option next to the textarea toggles the 'auto_insert' feature
'on' or 'off'.
'Off' displays just the docstring for the clicked command above the text
area
This kind of behavior and its display should be defined in any .zrc file
and should be able to be invoked in the zshell.
Thus
display_commands # show hyperlinked zshell commands above text area
auto_insert_off # jsut the man docstring
auto_insert_on # insert commands and dummy args
save_zrc [name] # save the present zshell dtml UI into .zrc file
# [zodb/tinytable/properties?]
load_zrc [name] # load a .zrc conifiguration
DTML + ZSHELL
Add a new tag so that Zshell commands can be run from DTML
A trivial example might go like this:
<dtml-zshell>
mkdir ../artists/$newartist
cd ../artists/$newartist
adduser $newartist/QWERTY
mkdir newprojects/outline
wget http://www.newsartists_website.org/work/outline
pwd
ls
</dtml-zshell>
This would create a new folder for the value of $newartist, a [yet to
implemented] zopeshell variable, which can also passed in by a form or some
DTML
Then add a newuser, and then upload load some HTML+graphics they already
have prepared online somewhere else.
-------------
3. RESULTS
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.
But I found that I quickly needcd to jump back and forth between repeat
commadnds when usign zshell. What I was missing was being able to scroll up
and down a familair shell windows, browse and cut''n'paste.
A possible solution:
Allow one to concatentate results to allow a single long scrolling one. This
could be a callable 'zhell_session_RESULTS' DTMLmethod. I think this would
allow one to be even more prodcutive in using Zshell to explore and manage a
Zopesite.
Presumably RESULTS connected to the machanism for history you are working
on...
As above, one shouldbe able to configure this from the shell and/or .zrc:
RESULTS_join
RESULTS_single
RESULTS_off
RESULTS_save [name]
RESULTS_load [name]
I suppose addressable RESULTS are instrinsic to any piping mechanism...
and thus wildcards, 'ls', 'cp' etc..
------------------
4. cd
Seems a little inconsistent at the moment partly becuase it does not resolve
"/"
I have a zshell in zope root "/"
cd .
Results:
cd: New folder is /
cd /images
Results:
cd: Incorrect path /images
WARNING: Errors were encountered
but
cd images
Results:
cd: New folder is /images
Both of the above should be valid.
Perhaps you disagree..
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:
<zshell>
cd happy
</zshell>
Results:
cd: Incorrect path happy
WARNING: Errors were encountered
---------------------
5. mkdir improvements
mkdir to handle a path option to complement cd from above
mkdir needs option flags to match the manual setting in ZMI of the 2
checkboxes for
Create public interface
Create user folder
mkdir newfolder -(p)ublic -(u)ser
Not sure what syntax would be best for doing this when creating a nested
mkdir:
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
--------------------
6. cp
Of course 'cp' should work across folders and also be able to paste in one
line.
Perhaps a lot of work. I don't know. And I hope zope acquisition logic does
not mangle this.
Needs to include wildcards of course
cp ../../images/earthrise.jpg ../graphics/earthrise.jpg
--------------------
9. wildcards
Obviously full Shell-type regular expressions, though desirable, might be a
big deal.
Some useful, obvious ones for ZopeShell wishlist whcih might be much easier
I can think of:
*
*meta
*date
*date_since
*date_before
*size_under
*size_over
*owner
*property
Examples of wildcards using ls:
ls *.jpeg # object whose names end with ".jpeg"
ls *meta='Image' # objects of meta_type 'Image'
ls *date='06-May-2001' # objects made on 6th May, 2001
ls *date='today' # object made today
ls *date_since='01-05-2001' # objects made since 5th January
ls *date_before='01-05-2001' # objects made before 5th January
ls *size_under='50kb' # objects less than 50kb
ls *size_over='500kb' # objects larger than 500kb
ls *owner='nikola' # objects owned by nikola
ls *property='description' # objects with a description property
--------------------
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.
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.
7. adduser
This is going to be very cool but, meanwhile I am not not clear what to 'do'
with adduser.
At least until there is a Zshell mechanism to get and set permissions, and
then pass them to the add user command. I confess I don't really understand
Local Roles in Zope either yet :-(
..so I better shut just up and do some more homework.
> * I can't make chown to work, do you have got any idea ?
not yet..
cheers
./Jason
___________________________________________________________
Jason CUNLIFFE = NOMADICS['Interactive Art and Technology']