commandline syntax

mskala at ansuz.sooke.bc.ca mskala at ansuz.sooke.bc.ca
Wed Apr 7 11:42:17 CEST 1999


On Wed, 7 Apr 1999, Werner Koch wrote:
> someone raised the question, whether to change the commandline syntax,
> so that it is more like tar(1) or ps(1).  I have no POSIX specs so I
> can't decide whether this is a good idea. Recent versions of ps(1) etc
> give you a warning, that the use of - is depreciated.

I think that it's unnecessary to create a distinction between "options"
and "commands".  My observation of how I think about options and commands
when I'm running a program, is that I just think of what things I want to
tell the program.  I don't mentally split it into "what to do"
(commands) and "how to modify it" (options).

My general inclination, then, is to specify all the options or commands
with a dash.  I type "tar -xzvf" even though I know the dash is
unnecessary.  I type "ps -fax", and curse at the "warning, - is
deprecated" message.  It seems to me that making the dash optional, or
worse, deprecated with message, just creates something extra for the user
to have to remember.  There's no reason obvious to me why it should be
necessary.  The dash *feels* more consistent with the rest of the
command-line syntax on my system, even though I'm aware that there's a
distinction I'm ignoring between "commands" and "options", and programs
that require a command versus programs that don't.

A fundamental principle of user-interface design is the principle of least
surprise; things should behave more or less the way the user expects them
to behave.  What I expect, because of my experience with other Unix
programs, is to type "-" in front of anything that isn't a filename, and
"--" in front of commands or options that are longer than a single letter.  
Making the slash optional is a feature I'll ignore; *complaining* about
the slash is a feature I'll find annoying and probably hack out of my
copy, because the feeling I get (regardless of what some standard may
say) is that it's the program doing something unusual in that case, not me.

Someone else mentioned the use of "--" to mark "the remaining arguments
are only files".  I'm not sure how necessary that is for gpg, but it is
useful with some other programs.  One final note is that most programs
seem to accept filenames and options/commands in any order unless
overridden with "--", and that's what seems most intuitive to me.  gpg
doesn't do that; it wants options/commands first and then files.  But
that's a relatively minor point.  tar wants its command first too, so
maybe we should stick with that if tar is being used as a model.

Matthew Skala  Ansuz BBS  (250) 472-3169  http://www.islandnet.com/~mskala/

                            GOD HATES SPAM





More information about the Gnupg-devel mailing list