I hope you don't mind me posting this to the main group, but I did
not want it to get lost...
Thanks for the pointer to the GNU option parsing code.
Here is what David Norris had previously suggested for switches:
From: "David Norris" <email@example.com>
Subject: RE: [SWISH-E] GNU-style switches
Date: Sat, 23 Jan 1999 17:19:18 -0500
X-Priority: 3 (Normal)
Well, I have tried to find some guidelines from GNU. No luck with that.
GNU usually has some sort of guidelines for these things. Maybe someone
else will find a reference or guidelines. In any case, here is a general
description using SWISH-E switches as an example:
-h, --help : display this help
-S, --index-system : specify indexing system
-i, --index-create : create index from specified files
-w, --words : search for words "word1 word2..."
-t, --limit-tags : tags to search in
-f, --index-file : index file to create or search
-c, --config : configuration file to use
-v, --verbose : verbosity level
-l, --symlinks : follow symbolic links
-m, --page-maxhits : maximum number of hits returned
--page-offset : return results after "###"
-M, --index-merge : merge index files
-D, --index-decode : decode index file
-p, --property : include properties in the output
-d, --delimiter : specify delimiter, dq means "
-V, --version : print current version
Hope that helps. Generally, you leave the short switches for backward
compatibility, add long switches for each short switch, and add new switches
using the long format. The long switches are more descriptive and prevents
you from running out of switch names.
-end of other msg-
I guess the GNU-style uses "--xx=yy" rather than "--xx yy", which is how
swish is currently set up. The only trouble we could foresee was in
options that take multiple arguments, such as the current "-w" switch
(or "--words" above) which is supposed to be followed by multiple words
(the words to search for). I suppose that could be handled as
--words="word1 word2" or "--words=word1 word2" but there is probably
a more correct way to do that. Personally, I would be happy ignoring the
"--xx=yy" format and just using the longer switch names and spaces
("--xx yy zz").
At 04:31 PM 2/12/99 -0500, you wrote:
>I came across this message of yours in the swish-e archive:
>> Can someone point me to/supply me with a description of the GNU
>> command line switch "style"? Even without knowing specifically what it
>> looks like I think it sounds like a great idea.
>I didn't see any replies in the archive, although I'd be astonished if
>someone hasn't already brought this up.
>The best way to implement the GNU "style" is to use the GNU options
>processing routines (getopt_long() and friends), which you can grab from
>the glibc distribution at:
>(You don't need the entire library, just:
>The file tstgetopt.c is a sample program that uses these routines.
>It's easy to use and very standard.
>Lars Kellogg-Stedman <firstname.lastname@example.org>
Received on Fri Feb 12 14:06:09 1999