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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id D1AF4BB83 for ; Tue, 23 May 2006 21:21:08 +0200 (CEST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id k4NJL8SU007937 for ; Tue, 23 May 2006 21:21:08 +0200 Received: (qmail invoked by alias); 23 May 2006 19:21:07 -0000 Received: from p54A32750.dip0.t-ipconnect.de (EHLO [192.168.2.10]) [84.163.39.80] by mail.gmx.net (mp016) with SMTP; 23 May 2006 21:21:07 +0200 X-Authenticated: #20477425 From: Michael Wohlwend To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Use Arg module to read keyword followed by unspecified number of arguments Date: Tue, 23 May 2006 21:21:25 +0200 User-Agent: KMail/1.9.1 Cc: mulhern References: <54f15b6e0605231017o5f23fd07q7f7b1c5cab38cf0b@mail.gmail.com> In-Reply-To: <54f15b6e0605231017o5f23fd07q7f7b1c5cab38cf0b@mail.gmail.com> X-Face: S)[vu%Bha1d&ej9GfwAq~7C}A,y[B.uS}+D6'hb~xPwsxymw$fnCOaMe<=?utf-8?q?*bnUajSBR=5Fm=3FR=0A=09?=@V3;iX8[A}z`.%pEQ1r7iZhN8#ktTCBQ}&mkx>=RH&l|l6\]NZI@ MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605232121.25349.micha-1@fantasymail.de> X-Y-GMX-Trusted: 0 X-Miltered: at concorde with ID 447360A4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; unspecified:01 commas:01 pred:01 pred:01 cheers:01 2006:98 squad:98 cigarette:98 blindfold:98 wrote:01 caml-list:01 parse:02 string:02 module:03 arg:03 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=SPF_FAIL autolearn=disabled version=3.0.3 On Tuesday 23 May 2006 19:17, mulhern wrote: > Hi! > > I expect to be reading something like this: > > -pred-files ... -key2 -extra-files > ... -key4 I think the idea by Till to separate the args with commas is best, but if you don't want to do this, maybe something like that would be o.k. : let mode_pred = ref true;; let pred_files = ref [];; let extra_files = ref [];; let key2 = ref "";; Arg.parse [ "-extra-files", Arg.Clear mode_pred, "extra files"; "-key2", Arg.Set_string key2, "key2"; "-pred-files", Arg.Set mode_pred, "pred files" ] (fun name -> if !mode_pred then pred_files := name :: !pred_files else extra_files := name :: !extra_files ) "usage..." ;; cheers, Michael -- C offers you enough rope to hang yourself. C++ offers a fully equipped firing squad, a last cigarette and a blindfold.