diff --git a/bin/Print.ml b/bin/Print.ml index 1a124d41..aec5e3fe 100644 --- a/bin/Print.ml +++ b/bin/Print.ml @@ -1,12 +1,18 @@ open Odiff.Diff +let esc = "\027[" +let red = esc ^ "31m" +let green = esc ^ "32m" +let bold = esc ^ "1m" +let dim = esc ^ "2m" +let reset = esc ^ "0m" + let printDiffResult makeParsableOutput result = - let reset_ppf = Spectrum.prepare_ppf Format.str_formatter in (match (result, makeParsableOutput) with | Layout, true -> () | Layout, false -> - Spectrum.Simple.printf "@{%s!@} Images have different layout.\n" - "Failure!" + Format.printf "%s%sFailure!%s Images have different layout.\n" red bold + reset | Pixel (_output, diffCount, diffPercentage, stack), true when not (Stack.is_empty stack) -> Int.to_string diffCount ^ ";" @@ -20,13 +26,13 @@ let printDiffResult makeParsableOutput result = |> print_endline | Pixel (_output, diffCount, _percentage, _lines), false when diffCount == 0 -> - Spectrum.Simple.printf - "@{Success!@} Images are equal.\n\ - @{No diff output created.@}" + Format.printf + "%s%sSuccess!%s Images are equal.\n%sNo diff output created.%s\n" green + bold reset dim reset | Pixel (_output, diffCount, diffPercentage, _lines), false -> - Spectrum.Simple.printf - "@{Failure!@} Images are different.\n\ - Different pixels: @{%i (%f%%)@}" diffCount diffPercentage); + Format.printf + "%s%sFailure!%s Images are different.\n\ + Different pixels: %s%s%i (%f%%)%s\n" + red bold reset red bold diffCount diffPercentage reset); - reset_ppf (); result diff --git a/bin/dune b/bin/dune index a9c7b904..1d02511d 100644 --- a/bin/dune +++ b/bin/dune @@ -4,11 +4,12 @@ (package odiff) (flags (:standard -w -27)) - (libraries odiff-core odiff-io cmdliner spectrum)) + (libraries odiff-core odiff-io cmdliner)) (env (dev - (flags (:standard -w +42))) + (flags (:standard -w +42)) + (ocamlopt_flags (:standard -S))) (release (ocamlopt_flags (:standard -O3 -rounds 5 -unbox-closures -inline 200 -inline-max-depth 7 -unbox-closures-factor 50)))) diff --git a/dune-project b/dune-project index e6eea588..b13970a9 100644 --- a/dune-project +++ b/dune-project @@ -24,7 +24,6 @@ odiff-core odiff-io (cmdliner (= 1.3.0)) - (spectrum (= 0.6.0)) ) ) diff --git a/odiff.opam b/odiff.opam index d845876d..2148379f 100644 --- a/odiff.opam +++ b/odiff.opam @@ -11,7 +11,6 @@ depends: [ "odiff-core" "odiff-io" "cmdliner" {= "1.3.0"} - "spectrum" {= "0.6.0"} "odoc" {with-doc} ] build: [