caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: 'Pass on' argument from Arg.parse to Arg.parse_argv
Date: Fri, 21 Jan 2005 16:48:12 +0000	[thread overview]
Message-ID: <20050121164812.GA16353@furbychan.cocan.org> (raw)


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.

-- 


             reply	other threads:[~2005-01-21 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-21 16:48 Richard Jones [this message]
2005-01-22 11:05 ` [Caml-list] " Jon Harrop
2005-01-22 16:29   ` Martin Willensdorfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050121164812.GA16353@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).