new utility: beegetopt

3 views
Skip to first unread message

Marius Tolzmann

unread,
Feb 28, 2012, 9:35:52 AM2/28/12
to bee...@googlegroups.com

moin..

introducing awesome BEEGETOPT !!!.. 8)

listen up! 8)

====cut====
Usage: beegetopt [options] -- [arguments and options to be parsed]

-o | --option=OPTION[,OPTION] Options to be recognized

-n | --name=NAME set program name
-N | --stop-on-no-option stop parsing when argument
is not an optiion
-U | --stop-on-unknown-option stop parsing when argument
is an unknown optiion
-S | --no-skip-unknown-option carp on unknown options
by default unknown options are skipped
and handled as non-option argument.
-S is ignored if -U is given.

-h | --help This little help
-V | --version Version information

OPTION may be a short or a long options or a combination of long and
short options seperated by a slash (/). In this case the second to last
option are considered aliases for the first. Only the first option is
returned as a new commandline argument: e.g.
--option long/alias/a/b will always return --long
--option a/b/long will always return -a

If the last character of OPTION is '=' this option will require an
argument. If it is ':' this option takes an optional argument: e.g.
--option name/n=

====cut====

now we can use beegetopt in bee tools and the bee wrapper..
forwarding all unknown options to the tool itself:

bee --help usage of bee
bee init --help usage of bee-init

have fun!

8)

usage in bash scripts is similar to the usage of getopt.

beegetopt is not intended to be compatible to getopt in any way.

m.

p.s.: we need a manpage - be(e) my guest 8)

p.p.s.: beegetopt may still be full of bugs.. please test.. 8)

--
Dipl.-Inf. Marius Tolzmann <marius....@molgen.mpg.de>
----------------------------------.------------------------------
MPI f. molekulare Genetik |
Ihnestrasse 63-73, D-14195 Berlin | ==> MarIuX GNU/Linux <==
Phone: +49 (0)30 8413 1709 |
----------------------------------^------------------------------
God put me on earth to accomplish a certain number of things.
Right now I am so far behind..
..I will never die. <by calvin from calvin&hobbes ;)>

Matthias Rüster

unread,
Feb 28, 2012, 12:19:41 PM2/28/12
to bee...@googlegroups.com
congratulations :)
quite a masterpiece writing "getopt++" in less than 1000 lines!

don't like the file naming though...
maybe moving bee_getopt.[ch] to beegetopt_util.[ch] or beegetopt_parse.[ch]
similarly we should move bee-dep.c to beedep.c

it is also possible to create subdirectories for each bee tool since there is no bee tool which
needs _all_ of the source files (?)

is the current HEAD of bee worth a tag or should we test beegetopt for a while before tagging?

MR

Marius Tolzmann

unread,
Feb 28, 2012, 1:03:24 PM2/28/12
to bee...@googlegroups.com
moin..

On 28.02.2012 18:19, Matthias R�ster wrote:
> don't like the file naming though...
> maybe moving bee_getopt.[ch] to beegetopt_util.[ch] or beegetopt_parse.[ch]
> similarly we should move bee-dep.c to beedep.c

nope.. bee_getopt.c is named after its primary function... bee_getopt().. 8)

and bee-dep is a bee-tool so it needs to be called bee-dep.. by
respecting the unwritten and poorly documented naming conventions.. 8)

> it is also possible to create subdirectories for each bee tool since
> there is no bee tool which needs _all_ of the source files (?)

? no.. 8) i don't want to revert a0c4692 ..

> is the current HEAD of bee worth a tag or should we test beegetopt for a
> while before tagging?

testing is always a good idea 8)..

m.

Reply all
Reply to author
Forward
0 new messages