Blame src/optParse.mli

rpm-build 0f2925
(*
rpm-build 0f2925
 * optParse - Functions for parsing command line arguments.
rpm-build 0f2925
 * Copyright (C) 2004 Bardur Arantsson
rpm-build 0f2925
 *
rpm-build 0f2925
 * Heavily influenced by the optparse.py module from the Python
rpm-build 0f2925
 * standard library, but with lots of adaptation to the 'Ocaml Way'
rpm-build 0f2925
 *
rpm-build 0f2925
 *
rpm-build 0f2925
 * This library is free software; you can redistribute it and/or
rpm-build 0f2925
 * modify it under the terms of the GNU Lesser General Public
rpm-build 0f2925
 * License as published by the Free Software Foundation; either
rpm-build 0f2925
 * version 2.1 of the License, or (at your option) any later version,
rpm-build 0f2925
 * with the special exception on linking described in file LICENSE.
rpm-build 0f2925
 *
rpm-build 0f2925
 * This library is distributed in the hope that it will be useful,
rpm-build 0f2925
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build 0f2925
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build 0f2925
 * Lesser General Public License for more details.
rpm-build 0f2925
 *
rpm-build 0f2925
 * You should have received a copy of the GNU Lesser General Public
rpm-build 0f2925
 * License along with this library; if not, write to the Free Software
rpm-build 0f2925
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
rpm-build 0f2925
 *)
rpm-build 0f2925
rpm-build 0f2925
(** Modules for GNU [getopt(3)]-style command line parsing. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
(** This module contains the basic functions and types for defining
rpm-build 0f2925
  new option types and accessing the values of options. *)
rpm-build 0f2925
module Opt :
rpm-build 0f2925
  sig
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Exceptions} *)
rpm-build 0f2925
rpm-build 0f2925
    exception No_value
rpm-build 0f2925
    (** [No_value] gets raised by {!OptParse.Opt.get} when an option
rpm-build 0f2925
      value is not available. *)
rpm-build 0f2925
rpm-build 0f2925
    exception Option_error of string * string
rpm-build 0f2925
    (** This exception signals that an option value is invalid. The
rpm-build 0f2925
      first string contains the option string ('-x' or '--long-name')
rpm-build 0f2925
      and the second string contains an error message.
rpm-build 0f2925
rpm-build 0f2925
      This exception is only used when implementing custom option types
rpm-build 0f2925
      and can never "escape" the scope of a {!OptParse.OptParser.parse}.
rpm-build 0f2925
      The user should therefore not attempt to catch it.  *)
rpm-build 0f2925
rpm-build 0f2925
    exception Option_help
rpm-build 0f2925
    (** When an option wants to display a usage message, this exception
rpm-build 0f2925
      may be raised.  It can never "escape" the scope of a
rpm-build 0f2925
      {!OptParse.OptParser.parse} call and the user should therefore not
rpm-build 0f2925
      attempt to catch it. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Types} *)
rpm-build 0f2925
rpm-build 0f2925
    type 'a t = {
rpm-build 0f2925
      option_set : string -> string list -> unit;
rpm-build 0f2925
      option_set_value : 'a -> unit;
rpm-build 0f2925
      option_get : unit -> 'a option;
rpm-build 0f2925
      option_metavars : string list;
rpm-build 0f2925
      option_defhelp : string option
rpm-build 0f2925
    }
rpm-build 0f2925
    (** Option type.
rpm-build 0f2925
rpm-build 0f2925
      [option_set] is a closure which converts and records the value of
rpm-build 0f2925
      an option so that it can be retrieved with a later call to the
rpm-build 0f2925
      [option_get] closure. It is called with the option name which was
rpm-build 0f2925
      given on the command line and a list of strings, each representing
rpm-build 0f2925
      one of the argument values given on the command line. It may raise
rpm-build 0f2925
      [Option_error] if the value is invalid (for whatever reason).
rpm-build 0f2925
rpm-build 0f2925
      [option_set_value] is a closure which sets the value of an option
rpm-build 0f2925
      to a particular value.
rpm-build 0f2925
rpm-build 0f2925
      [option_get] is a closure which retrieves the recorded value
rpm-build 0f2925
      of the option. If the option value has not been set from the
rpm-build 0f2925
      command line, the default value is used.  If there is no default
rpm-build 0f2925
      value, then [None] should be returned.
rpm-build 0f2925
rpm-build 0f2925
      [option_metavars] is a list of "meta-variables" (arguments)
rpm-build 0f2925
      which this option accepts. This is mainly for display purposes,
rpm-build 0f2925
      but the length of this list determines how many arguments the
rpm-build 0f2925
      option parser accepts for this option (currently only lists of
rpm-build 0f2925
      length 0 or 1 are supported).
rpm-build 0f2925
rpm-build 0f2925
      [option_defhelp] is the default help string (if any).  It is
rpm-build 0f2925
      used for displaying help messages whenever the user does {b
rpm-build 0f2925
      not} specify a help string manually when adding this
rpm-build 0f2925
      option. Using a non-None value here only makes sense for
rpm-build 0f2925
      completely generic options like {!OptParse.StdOpt.help_option}.
rpm-build 0f2925
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Option value retrieval} *)
rpm-build 0f2925
rpm-build 0f2925
    val get : 'a t -> 'a
rpm-build 0f2925
    (** Get the value of an option.
rpm-build 0f2925
rpm-build 0f2925
      @return the value of the option. If the option has not been
rpm-build 0f2925
      encountered while parsing the command line, the default value is
rpm-build 0f2925
      returned.
rpm-build 0f2925
rpm-build 0f2925
      @raise No_value if no default values has been given
rpm-build 0f2925
      and the option value has not been set from the command line.
rpm-build 0f2925
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
    val set : 'a t -> 'a -> unit
rpm-build 0f2925
    (** Set the value of an option. *)
rpm-build 0f2925
rpm-build 0f2925
    val opt : 'a t -> 'a option
rpm-build 0f2925
    (** Get the value of an option as an optional value.
rpm-build 0f2925
rpm-build 0f2925
      @return [Some x] if the option has value [x] (either by default or
rpm-build 0f2925
      from the command line). If the option doesn't have a value [None]
rpm-build 0f2925
      is returned. *)
rpm-build 0f2925
rpm-build 0f2925
    val is_set : 'a t -> bool
rpm-build 0f2925
    (** Find out if the option has a value (either by default or
rpm-build 0f2925
      from the command line).
rpm-build 0f2925
rpm-build 0f2925
      @return [True] iff the option has a value.
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Option creation} *)
rpm-build 0f2925
rpm-build 0f2925
    val value_option :
rpm-build 0f2925
      string -> 'a option -> (string -> 'a) -> (exn -> string -> string) ->
rpm-build 0f2925
        'a t
rpm-build 0f2925
    (** Make an option which takes a single argument.
rpm-build 0f2925
rpm-build 0f2925
      [value_option metavar default coerce errfmt] returns an option
rpm-build 0f2925
      which takes a single argument from the command line and calls
rpm-build 0f2925
      [coerce] to coerce it to the proper type. If [coerce] raises an
rpm-build 0f2925
      exception, [exn], then [errfmt exn argval] is called to generate
rpm-build 0f2925
      an error message for display. [metavar] is the name of the
rpm-build 0f2925
      metavariable of the option.
rpm-build 0f2925
rpm-build 0f2925
      [default] is the default value of the option. If [None], the the
rpm-build 0f2925
      option has no default value.
rpm-build 0f2925
rpm-build 0f2925
      @return the newly created option.
rpm-build 0f2925
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
    val callback_option :
rpm-build 0f2925
      string -> (string -> 'a) -> (exn -> string -> string) -> ('a -> unit) ->
rpm-build 0f2925
        unit t
rpm-build 0f2925
    (** Make a callback option which takes a single argument.
rpm-build 0f2925
rpm-build 0f2925
      [callback_option metavar coerce errfmt f] returns an option which
rpm-build 0f2925
      takes a single argument from the command line and calls [coerce]
rpm-build 0f2925
      to coerce it to the proper type. If [coerce] raises an exception
rpm-build 0f2925
      [errfmt exn argval] is called to format an error message for
rpm-build 0f2925
      display. If [coerce] succeeds, the callback function [f] is called
rpm-build 0f2925
      with the coerced value. Finally, [metavar] is the name of the
rpm-build 0f2925
      metavariable of the option.
rpm-build 0f2925
rpm-build 0f2925
      @return the newly created option.
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
  end
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
(** This module contains various standard options. *)
rpm-build 0f2925
module StdOpt :
rpm-build 0f2925
  sig
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Flag options} *)
rpm-build 0f2925
rpm-build 0f2925
    val store_const : ?default: 'a -> 'a -> 'a Opt.t
rpm-build 0f2925
    (** [store_const ?default const] returns a flag option which
rpm-build 0f2925
      stores the constant value [const] when the option is
rpm-build 0f2925
      encountered on the command line. *)
rpm-build 0f2925
rpm-build 0f2925
    val store_true : unit -> bool Opt.t
rpm-build 0f2925
    (** [store_true ()] returns an option which is set to true when
rpm-build 0f2925
      it is encountered on the command line. The default value is
rpm-build 0f2925
      false. *)
rpm-build 0f2925
rpm-build 0f2925
    val store_false : unit -> bool Opt.t
rpm-build 0f2925
    (** [store_false ()] returns an option which is set to false when
rpm-build 0f2925
      it is encountered on the command line. The default value is
rpm-build 0f2925
      true. *)
rpm-build 0f2925
rpm-build 0f2925
    val count_option : ?dest: int ref -> ?increment: int -> unit -> int Opt.t
rpm-build 0f2925
    (** Create a counting option which increments its value each time the
rpm-build 0f2925
      option is encountered on the command line.
rpm-build 0f2925
rpm-build 0f2925
      @param increment Increment to add to the option value each
rpm-build 0f2925
      time the option is encountered.
rpm-build 0f2925
rpm-build 0f2925
      @param dest Reference to the option value. Useful for making
rpm-build 0f2925
      options like '--quiet' and '--verbose' sharing a single value.
rpm-build 0f2925
rpm-build 0f2925
      @return the newly created option.
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
    val incr_option : ?dest: int ref -> unit -> int Opt.t
rpm-build 0f2925
    (** Exactly identical to [count_option ~dest:dest ~increment:1 ()]. *)
rpm-build 0f2925
rpm-build 0f2925
    val decr_option : ?dest: int ref -> unit -> int Opt.t
rpm-build 0f2925
    (** Exactly identical to [count_option ~dest:dest ~increment:(-1) ()]. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Value options} *)
rpm-build 0f2925
rpm-build 0f2925
    val int_option : ?default: int -> ?metavar: string -> unit -> int Opt.t
rpm-build 0f2925
    (** [int_option ?default ?metavar ()] returns an option which takes
rpm-build 0f2925
      a single integer argument. If [~default] is given it is the
rpm-build 0f2925
      default value returned when the option has not been encountered
rpm-build 0f2925
      on the command line. *)
rpm-build 0f2925
rpm-build 0f2925
    val float_option :
rpm-build 0f2925
      ?default: float -> ?metavar: string -> unit -> float Opt.t
rpm-build 0f2925
    (** See {!OptParse.StdOpt.int_option}. *)
rpm-build 0f2925
rpm-build 0f2925
    val str_option :
rpm-build 0f2925
      ?default: string -> ?metavar: string -> unit -> string Opt.t
rpm-build 0f2925
    (** See {!OptParse.StdOpt.int_option}. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Callback options} *)
rpm-build 0f2925
rpm-build 0f2925
    val int_callback : ?metavar: string -> (int -> unit) -> unit Opt.t
rpm-build 0f2925
    (** [int_callback ?metavar f] returns an option which takes a single
rpm-build 0f2925
      integer argument and calls [f] with that argument when encountered
rpm-build 0f2925
      on the command line. *)
rpm-build 0f2925
rpm-build 0f2925
    val float_callback : ?metavar: string -> (float -> unit) -> unit Opt.t
rpm-build 0f2925
    (** See {!OptParse.StdOpt.int_callback}. *)
rpm-build 0f2925
rpm-build 0f2925
    val str_callback : ?metavar: string -> (string -> unit) -> unit Opt.t
rpm-build 0f2925
    (** See {!OptParse.StdOpt.int_callback}. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Special options} *)
rpm-build 0f2925
rpm-build 0f2925
    val help_option : unit -> 'a Opt.t
rpm-build 0f2925
    (** [help_option ()] returns the standard help option which
rpm-build 0f2925
      displays a usage message and exits the program when encountered
rpm-build 0f2925
      on the command line. *)
rpm-build 0f2925
rpm-build 0f2925
    val version_option : (unit -> string) -> 'a Opt.t
rpm-build 0f2925
    (** [version_option f] returns the standard version option which
rpm-build 0f2925
      displays the string returned by [f ()] (and nothing else) on
rpm-build 0f2925
      standard output and exits. *)
rpm-build 0f2925
rpm-build 0f2925
  end
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
(** This module contains the types and functions for implementing
rpm-build 0f2925
  custom usage message formatters. *)
rpm-build 0f2925
module Formatter :
rpm-build 0f2925
  sig
rpm-build 0f2925
    type t = {
rpm-build 0f2925
      indent : unit -> unit; (** Increase the indentation level. *)
rpm-build 0f2925
      dedent : unit -> unit; (** Decrease the indentation level. *)
rpm-build 0f2925
      format_usage : string -> string; (** Format usage string into style of this formatter. *)
rpm-build 0f2925
      format_heading : string -> string; (** Format heading into style of this formatter. *)
rpm-build 0f2925
      format_description : string -> string; (** Format description into style of this formatter. *)
rpm-build 0f2925
      format_option :
rpm-build 0f2925
        char list * string list -> string list -> string option -> string (** Format option into style of this formatter (see explanation below). *)
rpm-build 0f2925
    }
rpm-build 0f2925
rpm-build 0f2925
    (** This is the type of a formatter. The [format_option] has
rpm-build 0f2925
      signature [format_option (snames,lnames) metavars help], where
rpm-build 0f2925
      [snames] is a list of the short option names, [lnames] is a
rpm-build 0f2925
      list of the long option names, [metavars] is a list of the
rpm-build 0f2925
      metavars the option takes as arguments, and [help] is the help
rpm-build 0f2925
      string supplied by the user.  *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Standard formatters} *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    val indented_formatter :
rpm-build 0f2925
      ?level: int ref -> ?indent: int ref -> ?indent_increment: int ->
rpm-build 0f2925
        ?max_help_position: int -> ?width: int -> ?short_first: bool ->
rpm-build 0f2925
        unit -> t
rpm-build 0f2925
    (** Create an "indented" formatter with the given options.
rpm-build 0f2925
rpm-build 0f2925
      @param width Total with of the usage messages printed.
rpm-build 0f2925
rpm-build 0f2925
      @param max_help_position Maximum starting column for the help
rpm-build 0f2925
      messages relating to each option.
rpm-build 0f2925
rpm-build 0f2925
      @param short_first List all the short option names first?
rpm-build 0f2925
rpm-build 0f2925
      @param indent_increment Number of columns to indent by when
rpm-build 0f2925
      more indentation is required.
rpm-build 0f2925
rpm-build 0f2925
      @param indent Reference to the current indentation amount. Its
rpm-build 0f2925
      value reflects changes in indentation level.
rpm-build 0f2925
rpm-build 0f2925
      @param level Reference to the current indentation level. Its
rpm-build 0f2925
      value reflects changes in indentation level.  *)
rpm-build 0f2925
rpm-build 0f2925
    val titled_formatter : ?level: int ref -> ?indent: int ref ->
rpm-build 0f2925
      ?indent_increment: int -> ?max_help_position: int ->
rpm-build 0f2925
      ?width: int -> ?short_first: bool -> unit -> t
rpm-build 0f2925
    (** Creates a titled formatter which is quite similar to the
rpm-build 0f2925
      indented formatter. See
rpm-build 0f2925
      {!OptParse.Formatter.indented_formatter} for a description of
rpm-build 0f2925
      the options. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Low-level formatting} *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    val wrap : ?initial_indent: int -> ?subsequent_indent: int ->
rpm-build 0f2925
      string -> int -> string list
rpm-build 0f2925
    (** [wrap text width] reflows the given text paragraph into lines
rpm-build 0f2925
      of width at most [width] (lines may exceed this if the are
rpm-build 0f2925
      single words that exceed this limit).
rpm-build 0f2925
rpm-build 0f2925
      @param initial_indent Indentation of the first line.
rpm-build 0f2925
rpm-build 0f2925
      @param subsequent_indent Indentation of the following lines.
rpm-build 0f2925
rpm-build 0f2925
      @return a list of lines making up the reformatted paragraph. *)
rpm-build 0f2925
rpm-build 0f2925
    val fill : ?initial_indent: int -> ?subsequent_indent: int ->
rpm-build 0f2925
      string -> int -> string
rpm-build 0f2925
    (** See {!OptParse.Formatter.wrap}.
rpm-build 0f2925
rpm-build 0f2925
      @return a string containing the reformatted paragraph. *)
rpm-build 0f2925
rpm-build 0f2925
  end
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
(** This module contains the option parser itself.
rpm-build 0f2925
rpm-build 0f2925
  It provides functions to create, populate and use option parsers to
rpm-build 0f2925
  parse command line arguments. *)
rpm-build 0f2925
module OptParser :
rpm-build 0f2925
  sig
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Exceptions} *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    exception Option_conflict of string
rpm-build 0f2925
    (** [Option_conflict name] is raised by {!OptParse.OptParser.add}
rpm-build 0f2925
      when two different options are added with identical
rpm-build 0f2925
      names. Usually this doesn't need to be caught since this error
rpm-build 0f2925
      is usually easily fixed permanently by removing/renaming the
rpm-build 0f2925
      conflicting option names. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Types} *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    type t
rpm-build 0f2925
    (** The type of an option parser. *)
rpm-build 0f2925
rpm-build 0f2925
    type group
rpm-build 0f2925
    (** The type of an option group. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Option parser creation} *)
rpm-build 0f2925
rpm-build 0f2925
    val make : ?usage: string -> ?status: int -> ?description: string -> ?version: string ->
rpm-build 0f2925
      ?suppress_usage: bool -> ?suppress_help: bool -> ?prog: string ->
rpm-build 0f2925
      ?formatter: Formatter.t -> unit -> t
rpm-build 0f2925
    (** Creates a new option parser with the given options.
rpm-build 0f2925
rpm-build 0f2925
      @param usage Usage message. The default is a reasonable usage
rpm-build 0f2925
      message for most programs. Any occurrence of the substring
rpm-build 0f2925
      ["%prog"] in [usage] is replaced with the name of the program
rpm-build 0f2925
      (see [prog]).
rpm-build 0f2925
rpm-build 0f2925
      @param prog Program name. The default is the base name of the
rpm-build 0f2925
      executable.
rpm-build 0f2925
rpm-build 0f2925
      @param suppress_usage Suppress the usage message if set.
rpm-build 0f2925
rpm-build 0f2925
      @param status Set the program exit status (default is 1).
rpm-build 0f2925
rpm-build 0f2925
      @param suppress_help Suppress the 'help' option which is
rpm-build 0f2925
      otherwise added by default.
rpm-build 0f2925
rpm-build 0f2925
      @param version Version string. If set, a '--version' option is
rpm-build 0f2925
      automatically added. When encountered on the command line it
rpm-build 0f2925
      causes [version] to be printed to the standard output and the
rpm-build 0f2925
      program to exit.
rpm-build 0f2925
rpm-build 0f2925
      @param description: description of the main purpose of the
rpm-build 0f2925
      program.
rpm-build 0f2925
rpm-build 0f2925
      @return the new option parser.
rpm-build 0f2925
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    val add : t -> ?group: group -> ?help: string -> ?hide: bool ->
rpm-build 0f2925
        ?short_name: char -> ?short_names: char list -> ?long_name: string ->
rpm-build 0f2925
        ?long_names: string list -> 'a Opt.t -> unit
rpm-build 0f2925
    (** Add an option to the option parser.
rpm-build 0f2925
rpm-build 0f2925
      @raise Option_conflict if the short name(s) or long name(s)
rpm-build 0f2925
      have alread been used for some other option.
rpm-build 0f2925
rpm-build 0f2925
      @param help Short help message describing the option (for the usage message).
rpm-build 0f2925
rpm-build 0f2925
      @param hide If true, hide the option from the usage
rpm-build 0f2925
      message. This can be used to implement "secret" options which
rpm-build 0f2925
      are not shown, but work just the same as regular options in all
rpm-build 0f2925
      other respects.
rpm-build 0f2925
rpm-build 0f2925
      @param short_name is the name for the short form of the option
rpm-build 0f2925
      (e.g. ['x'] means that the option is invoked with [-x] on the
rpm-build 0f2925
      command line).
rpm-build 0f2925
rpm-build 0f2925
      @param short_names is a list of names for the short form of the
rpm-build 0f2925
      option (see [short_name]).
rpm-build 0f2925
rpm-build 0f2925
      @param long_name is the name for the long form of the option
rpm-build 0f2925
      (e.g. ["xyzzy"] means that the option is invoked with [--xyzzy]
rpm-build 0f2925
      on the command line).
rpm-build 0f2925
rpm-build 0f2925
      @param long_names is a list of names for the long form of the
rpm-build 0f2925
      option (see [long_name]).
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    val add_group : t -> ?parent: group -> ?description: string ->
rpm-build 0f2925
      string -> group
rpm-build 0f2925
    (** Add a group to the option parser.
rpm-build 0f2925
rpm-build 0f2925
      @param parent is the parent group (if any).
rpm-build 0f2925
rpm-build 0f2925
      @param description is a description of the group.
rpm-build 0f2925
rpm-build 0f2925
      @return the new group.
rpm-build 0f2925
rpm-build 0f2925
    *)
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Output and error handling} *)
rpm-build 0f2925
rpm-build 0f2925
    val error : t -> ?chn: out_channel -> ?status: int -> string -> 'a
rpm-build 0f2925
    (** Display an error message and exit the program. The error
rpm-build 0f2925
      message is printed to the channel [chn] (default is
rpm-build 0f2925
      [Pervasives.stderr]) and the program exits with exit status
rpm-build 0f2925
      [status] (default depends on [t] : see [make]). *)
rpm-build 0f2925
rpm-build 0f2925
    val usage : t -> ?chn: out_channel -> unit -> unit
rpm-build 0f2925
    (** Display the usage message to the channel [chn] (default is
rpm-build 0f2925
      [Pervasives.stdout]) and return. *)
rpm-build 0f2925
rpm-build 0f2925
rpm-build 0f2925
    (** {6 Option parsing} *)
rpm-build 0f2925
rpm-build 0f2925
    val parse : t -> ?first: int -> ?last: int -> string array -> string list
rpm-build 0f2925
    (** Parse arguments as if the arguments [args.(first)],
rpm-build 0f2925
      [args.(first+1)], ..., [args.(last)] had been given on the
rpm-build 0f2925
      command line. By default [first] is 0 and [last] is the index
rpm-build 0f2925
      of the last element of the array. *)
rpm-build 0f2925
rpm-build 0f2925
    val parse_argv : t -> string list
rpm-build 0f2925
    (** Parse all the arguments in [Sys.argv]. *)
rpm-build 0f2925
rpm-build 0f2925
  end