[CLOpt] remove `accept_unknown` optional argument of `parse`

Summary: Also updated the doc comment of `parse`, it had gone a bit out of sync.

Reviewed By: jberdine

Differential Revision: D4435580

fbshipit-source-id: bb1a6f2
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent ebc4c6fd53
commit 4b45d5d8a0

@ -594,8 +594,7 @@ let extra_env_args = ref []
let extend_env_args args =
extra_env_args := List.rev_append args !extra_env_args
let parse ?(incomplete=false) ?(accept_unknown=false) ?config_file current_exe exe_usage
~should_parse_cl_args =
let parse ?(incomplete=false) ?config_file current_exe exe_usage ~should_parse_cl_args =
let full_speclist = ref []
in
let usage_msg = exe_usage current_exe
@ -707,7 +706,7 @@ let parse ?(incomplete=false) ?(accept_unknown=false) ?config_file current_exe e
arg_being_parsed := 0;
(* tests if msg indicates an unknown option, as opposed to a known option with bad argument *)
let is_unknown msg = String.is_substring msg ~substring:": unknown option" in
accept_unknown_args := accept_unknown ;
accept_unknown_args := false ;
let rec parse_loop () =
try
Arg.parse_argv_dynamic ~current:arg_being_parsed !args_to_parse curr_speclist

@ -147,18 +147,23 @@ val env_var_sep : char
(** [extend_env_args args] appends [args] to those passed via [args_env_var] *)
val extend_env_args : string list -> unit
(** [parse env_var exe_usage exe] parses command line arguments as specified by preceding calls to
the [mk_*] functions, and returns a function that prints the usage message and help text then
exits. [exe] is used to construct the help message appropriate for that executable. The decoded
values of the inferconfig file [config_file], if provided, and of the environment variable
[env_var] are prepended to [Sys.argv] before parsing. Therefore arguments passed on the command
line supersede those specified in the environment variable, which themselves supersede those
passed via the config file. WARNING: An argument will be interpreted as many times as it
appears in all of the config file, the environment variable, and the command line. The [env_var]
is set to the full set of options parsed. If [incomplete] is set, unknown options are ignored,
and [env_var] is not set. If [accept_unknown] is set, unknown options are treated the same as
anonymous arguments. *)
val parse : ?incomplete:bool -> ?accept_unknown:bool -> ?config_file:string ->
(** [parse exe exe_usage exe] parses command line arguments as specified by preceding calls to the
[mk_*] functions, and returns a function that prints the usage message and help text then exits.
[exe] is used to construct the help message appropriate for that executable.
The decoded values of the inferconfig file [config_file], if provided, are parsed, followed by
the decoded values of the environment variable [args_env_var], followed by [Sys.argv] if
[should_parse_cl_args] is true. Therefore arguments passed on the command line supersede those
specified in the environment variable, which themselves supersede those passed via the config
file.
If [incomplete] is set, unknown options are ignored, and [args_env_var] is not set.
WARNING: An argument will be interpreted as many times as it appears in all of the config file,
the environment variable, and the command line. The [args_env_var] is set to the full set of
options parsed. *)
val parse : ?incomplete:bool -> ?config_file:string ->
exe -> (exe -> Arg.usage_msg) -> should_parse_cl_args:bool -> (int -> 'a)
(** [is_env_var_set var] is true if $[var]=1 *)

Loading…
Cancel
Save