Parcourir la source

Add warning when the number is out of range

Leo il y a 10 ans
Parent
commit
ce5ce7db8b
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      src/exec_cmd.ml

+ 5 - 1
src/exec_cmd.ml

@@ -41,7 +41,11 @@ let num_cmd_to_cmd ~cmd_list number =
   (* Verify that the number is not out of the list *)
   if (List.length cmd_list) < number
   then
-    ""
+      begin
+          (* TODO Make this printing configurable *)
+          printf "Out of range. Do not do anything.";
+          ""
+      end
   else
     begin
       let cmd_to_exec = List.nth cmd_list number in