Version française
Home     About     Download     Resources     Contact us    
Browse thread
Arg parsing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: William Lovas <wlovas@s...>
Subject: Re: [Caml-list] Arg parsing
Hi Thomas,

On Tue, Oct 26, 2004 at 09:56:30PM +0200, Thomas Fischbacher wrote:
> 
> I think it would be helpful if ocaml had an '--' arg that tells it to stop 
> its own arg parsing and pass the following args on to the program started, 
> as in:
> 
> tf@ouija:~$ perl -e 'print @ARGV' -- one tooth ree
> onetoothree

You can do this with the standard Arg module.  For example:

    Arg.parse [...; ("--", Arg.Rest anon_fun, "  stop parsing options")]
              anon_fun
              usage_msg

See the Arg module's documentation for details.

cheers,
William