On Fri, Dec 16, 2011 at 07:22:02PM -0800, Josh Dersch wrote:
Let's start with the "rm *" example. "rm *" is a particular
invokation of rm that isn't commonly used -- it's an exceptional
case that someone really wants to delete all files in a particular
directory. Is it annoying to anyone to either answer "y" to an "Are
you sure?" prompt or type in "rm -y *" to autoconfirm in these few
cases?
Bad idea, breaks the generic user interface assumption that the machine
just goes and does what it is being told instead of nagging you with
"are you really sure?" prompts in the default case.
Unix standard: the training wheels are off, the user is assumed to know WTF
he/she/it is doing. If you want the training wheels, switch them on
explicitly, but don't annoy the experts all the time. ;-)
In that case of rm, the "training wheels on" mode is already available, just
use "rm -i".
Even if it is slightly more work, think of the
tradeoff
that's being made: you're saving every Unix user the pain of
accidentally screwing themselves via a typo -- and just as evidenced
by responses on this list, *everyone* (well, mostly everyone) has
managed to do this at least once or knows someone who has.
Live and learn. And pain is a very powerful mnemonic fixative ;-)
Another example, from Symbolics Genera (which I've
been spending a
fair amount of time with). The Command line in the Lisp Listener
has a few wonderful features which manage to be both powerful *and*
helpful at the same time. (It also has a few warts, but I believe
the ideas present in it are something worthy of being brought back).
First of all, commands are verbose and self-descriptive -- for
example, the command to copy a file is:
:Copy File
That's a lot of typing (especially for more lengthy commands like
"Show Machine Configuration". Fortunately this has been dealt with
by only requiring the user to type as much of a command needed to
disambiguate it -- "S Mac" works for the latter case, "Cop F" is
enough for the former.
Whereas in Unix it is just "cp". Clearly superior. *tongue-firmly-in-cheek*
Once you've finished typing "Copy File"
the listener immediately
appends some simple context-sensitive information hinting at the
arguments, so you end up the below on your screen:
:Copy File (pathnames of files) _
What if you've forgotten the name of the file you want to copy? Hit
Ctrl-/ and it'll give you a list of files in the most recently
accessed directory, or will show files that start with a path you've
partially completed. You can then either type one in from the list
and hit the "Complete" key or click on one of the filenames listed.
(The commandline is mouse-sensitive as well.)
At this point the command prompt helps you again with the second
argument (hinting that you need to type in the "to" portion of the
copy), and you have:
:Copy file (pathnames of files) FOO:>bar>baz.lisp;4 (to [default
<most recently used path>]) _
And you type in the destination, and again are prompted:
:Copy file (pathnames of files) FOO:>bar>baz.lisp;4 (to [default
<most recently used path>]) FOO:>bar>quux.lisp (keywords) _
It's now hinting that "Copy File" takes optional keywords. If you
don't need them, hit "Return" to execute the command, otherwise you
can hit "Ctrl-/" (consistency!) to see a list of possible keyword
arguments and a brief documentation string for each, as seen
(excerpted) below:
These are the possible keyword arguments:
:Byte Size Byte size in which to do copy operation
:Copy Properties Properties of the file to be duplicated
:Create Directories What to do if a destination directory does not exist
:If Exists What to do if asked to copy to an existing file
Well, if you want that, just write a shell implementing that. It is probably
easiest for that to build on some existing implementation, like the scsh.
Kind regards,
Alex.
--
"Opportunity is missed by most people because it is dressed in overalls and
looks like work." -- Thomas A. Edison