diff options
| -rwxr-xr-x | bin/css_merge.ml | 20 | ||||
| -rwxr-xr-x | bin/dune | 1 | ||||
| -rwxr-xr-x | css_lib.opam | 1 | ||||
| -rwxr-xr-x | css_merge.opam | 2 | ||||
| -rwxr-xr-x | dune-project | 2 | ||||
| -rwxr-xr-x | readme.rst | 2 | 
6 files changed, 15 insertions, 13 deletions
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 @@ -13,6 +13,5 @@      stdio      css_lib   ) - (preprocess (pps ppx_deriving_argparse))  ) diff --git a/css_lib.opam b/css_lib.opam index 9cd227c..fac0838 100755 --- a/css_lib.opam +++ b/css_lib.opam @@ -5,6 +5,7 @@ synopsis: "Css merger"  maintainer: ["Sébastien Dailly"]  authors: ["Sébastien Dailly"]  license: "MIT" +homepage: "https://git.chimrod.com/css_lib.git/about/"  depends: [    "dune" {>= "2.1"}    "ocaml" {>= "4.10.0"} diff --git a/css_merge.opam b/css_merge.opam index e0d7f0f..47dcee6 100755 --- a/css_merge.opam +++ b/css_merge.opam @@ -5,11 +5,11 @@ synopsis: "Css merger"  maintainer: ["Sébastien Dailly"]  authors: ["Sébastien Dailly"]  license: "MIT" +homepage: "https://git.chimrod.com/css_lib.git/about/"  depends: [    "dune" {>= "2.1"}    "ocaml" {>= "4.10.0"}    "css-parser" {>= "0.2.4"} -  "ppx_deriving_argparse" {>= "0.0.5"}    "css_lib" {>= "1.0"}  ]  build: [ diff --git a/dune-project b/dune-project index ecfba48..22a02ba 100755 --- a/dune-project +++ b/dune-project @@ -5,6 +5,7 @@  (generate_opam_files true)  (authors "Sébastien Dailly")  (maintainers "Sébastien Dailly") +(homepage "https://git.chimrod.com/css_lib.git/about/")  (license "MIT")  (package  @@ -13,7 +14,6 @@    (depends     (ocaml (>= 4.10.0))     (css-parser (>= 0.2.4)) -   (ppx_deriving_argparse (>= 0.0.5))     (css_lib (>= 1.0))     ) @@ -34,7 +34,7 @@ Usage  .. code-block:: bash - css_merge -out ${out_file} file1.css file2.css … + css_merge --out ${out_file} file1.css file2.css …  The file `file1.css` and `file2.css` will be combined together, the rule from  `file2.css` overrides the one given in `file1.css`.  | 
