caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* 'Pass on' argument from Arg.parse to Arg.parse_argv
@ 2005-01-21 16:48 Richard Jones
  2005-01-22 11:05 ` [Caml-list] " Jon Harrop
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2005-01-21 16:48 UTC (permalink / raw)
  To: caml-list


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.

-- 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-22 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 16:48 'Pass on' argument from Arg.parse to Arg.parse_argv Richard Jones
2005-01-22 11:05 ` [Caml-list] " Jon Harrop
2005-01-22 16:29   ` Martin Willensdorfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).