Parcourir la source

Merge branch 'dev' of gitlab.com:WzukW/oclaunch into dev

Leo il y a 9 ans
Parent
commit
ac8350966d
3 fichiers modifiés avec 12 ajouts et 7 suppressions
  1. 9 5
      fix-indent.ml
  2. 1 1
      opam
  3. 2 1
      src/command_def.ml

+ 9 - 5
fix-indent.ml

@@ -36,8 +36,11 @@
 (******************************************************************************)
 
 open Core.Std;;
-(* TODO:
- * - Tidy exit codes *)
+
+(* Exit codes *)
+let exit_ok () = exit 0;;
+let exit_arg_lack () = exit 1;;
+let exit_ocp_indent_error () = exit 2;;
 
 let ignored =
   (* File (space separated) to be ignored, regexp passed to tree command *)
@@ -74,7 +77,8 @@ let ocp_indent file =
   |> Sys.command
   |> function
   | 0 -> printf "File: '%s' ok\n" file
-  | error -> printf "Error with file: '%s'; code: %i\n%!" file error; exit 3
+  | error -> printf "Error with file: '%s'; code: %i\n%!" file error;
+      exit_ocp_indent_error ()
 ;;
 
 let () =
@@ -82,9 +86,9 @@ let () =
     [| _; path |] ->
     list_mlfiles path |> List.iter ~f:ocp_indent;
     printf "Done\n%!";
-    exit 0
+    exit_ok ()
   | _ -> printf "Usage: %s [directory containing file to indent]\n"
            Sys.executable_name;
-    exit 1
+    exit_arg_lack ()
 ;;
 

+ 1 - 1
opam

@@ -17,7 +17,7 @@ remove: ["ocamlfind" "remove" "ocl"]
 depends: [
   "atdgen"
   "base-threads"
-  "core"
+  "core" {>= "112.35.00"}
   "textutils"
   "re2"
   "ocamlfind" {build}

+ 2 - 1
src/command_def.ml

@@ -229,7 +229,8 @@ let licence =
            ~doc:" Display the header of the licence"
     )
     (fun _ header () ->
-       let cecill = not(header) in (* When cecill is false, it displays the header *)
+       (* When cecill is false, it displays the header *)
+       let cecill = not(header) in
        Licencing.print ~cecill
     )
 ;;