English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Use Arg module to read keyword followed by unspecified number of arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-05-23 (17:17)
From: mulhern <mulhern@g...>
Subject: Use Arg module to read keyword followed by unspecified number of arguments
Hi!

I expect to be reading something like this:

-pred-files <arg1> <arg2> ... <argn> -key2 <arg> -extra-files <arg1>
<arg2> ... <argn> -key4

There may be 0 or more <args> specified after -pred-files and after
-extra-files. I need to treat the args differently depending on what
keyword they are associated with.

I can think of about 10 ways to do this using the Arg module, but
they're all ugly and all different. Does anybody have an attractive
solution to this problem or is aware of the accepted way to handle
this situation? An example in some existing code would be good enough.

I do not consider changing the call to
-pred-files <arg1> -pred-files <arg2> ... -pred-files <argn> ......
an option at this time, principally because the call is automatically
generated and I'ld like it to stay in line with the other
automatically generated calls in the same distribution.

Thanks!

-mulhern