Skip to content

Commit

Permalink
Remove duplicate --diff option to fix 'autofonce rst'
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Jan 20, 2024
1 parent 77d6c7f commit 2f69a2d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/autofonce_lib/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ let main () =
let common_args = [
] in

(* Check to avoid errors in 'autofonce rst' *)
List.iter EZCMD.TYPES.(fun cmd ->
let args = cmd.sub_args in
let args = List.map (fun (args, _order, _info) ->
"--" ^ String.concat " | --" args
) args in
let args = List.sort compare args in
let rec iter args =
match args with
| arg1 :: arg2 :: _ when arg1 = arg2 ->
Printf.eprintf
"ERROR: sub-command %S contains twice option '--%s'\n%!"
cmd.sub_name arg1;
exit 2
| [] -> ()
| _ :: args -> iter args
in
iter args
) commands ;

MAIN.main
~on_error: (fun () -> () )
~on_exit: (fun () -> () )
Expand Down
5 changes: 5 additions & 0 deletions src/autofonce_lib/runner_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ let args () =
[ "no-clean" ], Arg.Unit (fun () -> args.arg_clean_tests_dir <- false),
EZCMD.info "Do not clean _autofonce/ dir on startup";

(* This option is not useful I think, and causes a failure in
'autofonce rst' because it creates two "--diff" options for
'autofonce promote'
[ "diff" ], Arg.Unit (fun () ->
args.arg_auto_promote <- 1),
EZCMD.info "Print a diff showing what would be promoted";
*)

[ "o" ; "output" ], Arg.String (fun s -> args.arg_output <- Some s),
EZCMD.info
Expand Down

0 comments on commit 2f69a2d

Please sign in to comment.