[CLOpt] allow to override the subcommand in infer sub-processes

Summary:
Error'ing when getting several subcommands on the command line only makes sense
when the user typed these options herself. This was causing a bug in the Gradle
integration, and possibly others (see GitHub issue).

Fixes #668

Reviewed By: jeremydubreil

Differential Revision: D5381850

fbshipit-source-id: f332377
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent c1905b87b1
commit e79f3837c3

@ -658,10 +658,10 @@ let anon_fun arg =
else if !anon_arg_action.parse_subcommands
&& List.Assoc.mem !subcommand_actions ~equal:String.equal arg then
let command_switch = List.Assoc.find_exn !subcommand_actions ~equal:String.equal arg in
match !curr_command with
| None ->
match !curr_command, is_originator with
| None, _ | Some _, false ->
command_switch ()
| Some command ->
| Some command, true ->
raise (Arg.Bad
(Printf.sprintf "More than one subcommand specified: '%s', '%s'"
(string_of_command command) arg))

Loading…
Cancel
Save