From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 67C2ABB91 for ; Fri, 21 Jan 2005 17:48:18 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0LGmIpZ001953 for ; Fri, 21 Jan 2005 17:48:18 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA17000 for ; Fri, 21 Jan 2005 17:48:17 +0100 (MET) Received: from furbychan.cocan.org (use.the.admin.shell.to.set.your.reverse.dns.for.this.ip [80.68.91.176] (may be forged)) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0LGmEGZ028982 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 21 Jan 2005 17:48:17 +0100 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1Cs1xE-0004G7-00 for ; Fri, 21 Jan 2005 16:48:12 +0000 Date: Fri, 21 Jan 2005 16:48:12 +0000 To: caml-list@inria.fr Subject: 'Pass on' argument from Arg.parse to Arg.parse_argv Message-ID: <20050121164812.GA16353@furbychan.cocan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i From: Richard Jones X-Miltered: at nez-perce with ID 41F13252.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41F1324E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; argv:01 command-line:01 wrote:01 val:01 val:01 defaults:01 bool:01 verbose:01 bool:01 verbose:01 argv:01 argument:01 parse:02 parse:02 string:03 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.0 X-Spam-Level: I have a bunch of command-line programs which take a standard set of arguments, so I wrote a module 'StdArg' which each program uses to parse arguments. That module provides an interface like this: ---------------------------------------------------------------------- val username : string val password : string val client : string option (** Username, password, client passed on the command line (or defaults). *) val update : bool (** True if the [--update] flag was passed on the command line, instructing * the program to perform updates. *) val verbose : bool (** True if the [--verbose] flag was passed on the command line, instructing * the program to be verbose. *) val args : string list (** Remaining, unparsed arguments on the command line. *) ---------------------------------------------------------------------- Now, one of my programs requires an additional flag on the command line. The original idea was that this program could call: Arg.parse_argv args argspec [etc.] but this unfortunately doesn't work, because the program doesn't get beyond the StdArg call to Arg.parse before printing this error message and exiting: ./prog: unknown option `--foobar'. [followed by usage message] Is there a way to do this? I'd like Arg.parse to ignore unknown args. Rich. --