From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 03EFABB83 for ; Tue, 23 May 2006 19:29:11 +0200 (CEST) Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.207]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4NHTAiE023707 for ; Tue, 23 May 2006 19:29:10 +0200 Received: by wx-out-0102.google.com with SMTP id i27so908848wxd for ; Tue, 23 May 2006 10:29:09 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ltP5kbAkxtdyS+cRc92fn9u/TVfv35D8jofHqmY/E99GCGw4HJTwBIYRm2LS84TFSGVnPminU92PjOcL/gbxK73S0gLPyAR/MZQj/bqGJrVeFE2O3LJ/CQB4bQeQuKQ++ybBZqVgCH/6pX8X3dRdCUgMB4LauSJ6h7AMJQ0X1YQ= Received: by 10.70.59.13 with SMTP id h13mr6642207wxa; Tue, 23 May 2006 10:29:09 -0700 (PDT) Received: by 10.70.125.16 with HTTP; Tue, 23 May 2006 10:29:09 -0700 (PDT) Message-ID: <9d3ec8300605231029t2ac1bc92k739b22c0a6931371@mail.gmail.com> Date: Tue, 23 May 2006 19:29:09 +0200 From: "Till Varoquaux" To: mulhern Subject: Re: [Caml-list] Use Arg module to read keyword followed by unspecified number of arguments Cc: caml-list@yquem.inria.fr In-Reply-To: <54f15b6e0605231017o5f23fd07q7f7b1c5cab38cf0b@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <54f15b6e0605231017o5f23fd07q7f7b1c5cab38cf0b@mail.gmail.com> X-j-chkmail-Score: MSGID : 44734666.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44734666.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; unspecified:01 regexp:01 cheers:01 beginner's:01 ocaml:01 beginners:01 bug:01 ......:98 wrote:01 caml-list:01 caml-list:01 bin:01 strings:01 caml:02 caml:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 You could work around with references but I guess you'd consider this as ugly. A comma separated list of strings could do the trick: "-pred-files", Arg.String (fun s -> predfiles:=3DStr.split (Str.regexp_string ",") s),"...") cheers, Till On 5/23/06, mulhern wrote: > Hi! > > I expect to be reading something like this: > > -pred-files ... -key2 -extra-files > ... -key4 > > There may be 0 or more 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 -pred-files ... -pred-files ...... > 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 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >