Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove load-time argv parsing #1148

Merged
merged 1 commit into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
+ Testing interactions between break-infix and break-infix-before-func (#1136) (Guillaume Petiot)
+ Add dune to repositories checked for regressions (#1129) (Jules Aguillon)
+ Use an expect test for cli tests (#1126) (Etienne Millon)
+ Factor out a private library (#1134) (Etienne Millon)
+ Factor out a private library (#1134, #1148) (Etienne Millon)
+ Remove global reference `Cmts.remove` (#1142) (Etienne Millon)

#### Documentation
Expand Down
2 changes: 1 addition & 1 deletion bin/ocamlformat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ let source_from_file = function
| File f -> In_channel.with_file f ~f:In_channel.input_all

;;
match Conf.action with
match Conf.action () with
| Inplace inputs ->
let errors =
List.filter_map inputs
Expand Down
2 changes: 1 addition & 1 deletion bin/ocamlformat_reason.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let to_output_file output_file data =
| Some output_file -> Out_channel.write_all output_file ~data

;;
match Conf.action with
match Conf.action () with
| Inplace _ -> user_error "Cannot convert Reason code with --inplace" []
| Check _ -> user_error "Cannot check Reason code with --check" []
| In_out ({kind; file; name= input_name; conf}, output_file) -> (
Expand Down
2 changes: 1 addition & 1 deletion lib/Conf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,7 @@ let validate () =
| Error e -> `Error (false, e)
| Ok action -> `Ok action

let action = parse info validate
let action () = parse info validate

let debug = !debug

Expand Down
2 changes: 1 addition & 1 deletion lib/Conf.mli
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type action =
(** Check whether the input files already are formatted. *)
| Print_config of t (** Print the configuration and exit. *)

val action : action
val action : unit -> action
(** Formatting action: input type and source, and output destination. *)

val debug : bool
Expand Down