From 6d498ac858306944c09718c329191631ece91ee5 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Tue, 26 Oct 2021 21:13:25 +0200 Subject: Removed ppx-args dep --- bin/css_merge.ml | 20 +++++++++++--------- bin/dune | 1 - 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/css_merge.ml b/bin/css_merge.ml index 7e0ee6b..42e6f6f 100755 --- a/bin/css_merge.ml +++ b/bin/css_merge.ml @@ -2,12 +2,8 @@ open StdLabels module Args = struct type t = - { out: string [@short "-o"] - } [@@deriving argparse{ - positional = - [ "css", "The css file" - ] - }] + { out: string + } let default = { out = "" @@ -16,8 +12,14 @@ end let () = - let arg, rest = Args.argparse Args.default "css_merge" Sys.argv in - let css = Array.fold_left rest + let out = ref "" + and rest = ref [] in + let speclist = + [ ("--out", Arg.Set_string out, "Output file") + ; ("-o", Arg.Set_string out, "Output file") ] in + Arg.parse speclist (fun arg -> rest := arg::(!rest)) "css_merge"; + let rest = List.rev (!rest) in + let css = List.fold_left rest ~init:Css_lib.Merge.empty ~f:(fun map arg -> let content = Stdio.In_channel.read_all arg in @@ -25,7 +27,7 @@ let () = Css_lib.Merge.add_css map css ) in - Stdio.Out_channel.with_file arg.Args.out ~f:(fun channel -> + Stdio.Out_channel.with_file !out ~f:(fun channel -> let format = Format.formatter_of_out_channel channel in Css_lib.Print.css Css_lib.Print.minify_printer diff --git a/bin/dune b/bin/dune index 279a658..240bca8 100755 --- a/bin/dune +++ b/bin/dune @@ -13,6 +13,5 @@ stdio css_lib ) - (preprocess (pps ppx_deriving_argparse)) ) -- cgit v1.2.3