Browse Source

Make env variable OC_NOCOLOR working

 + Solve problems introduced in commit 8a3ae795f4099c9478477e4dd46b186cb47eeb2c,
 with variable not working.
 + Change semantics (OC_COLOR -> OC_NOCOLOR for variable name, change the rest
 accordingly).
 + Integrate variable set by env in command_def.
 + Related to issue #20.
Leo 9 years ago
parent
commit
3cc1374d4a
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/command_def.ml
  2. 1 1
      src/const.ml

+ 1 - 1
src/command_def.ml

@@ -53,7 +53,7 @@ let shared_params =
          (* Set the level of verbosity *)
          Const.verbosity := verbosity;
          (* Do not use color *)
-         Const.no_color := no_color;
+         Const.no_color := no_color || !Const.no_color;
          (* Use given rc file, should run the nth argument if present *)
          Const.rc_file := (Lazy.return rc_file_name);
          (* Active signal handling *)

+ 1 - 1
src/const.ml

@@ -75,7 +75,7 @@ let verbosity =
        |> Int.of_string);;
 (* Use do not use colors, 0 -> false, anything -> true *)
 let no_color =
-  ref (get_var ~default:(lazy "1") (lazy "OC_COLOR")
+  ref (get_var ~default:(lazy "0") (lazy "OC_NOCOLOR")
        |> Lazy.force
        |> (function "0" -> false | _ -> true)
       )