Browse Source

Solve problem with command parsing

Default command was not executed, i.e. when launching without, the program was
not terminating
Leo 9 years ago
parent
commit
97f6e2799e
1 changed files with 13 additions and 10 deletions
  1. 13 10
      src/command_def.ml

+ 13 - 10
src/command_def.ml

@@ -122,16 +122,19 @@ let commands =
        (* Edit the nth command *)
        (* Edit the nth command *)
        else if modify then Edit_command.run ~rc:rc_content default_n
        else if modify then Edit_command.run ~rc:rc_content default_n
        else
        else
+         begin
            (* Other things to test, especially flags with arguments *)
            (* Other things to test, especially flags with arguments *)
            (* Reset to a value *)
            (* Reset to a value *)
-         reset_cmd |>
-            function
-              | Some reset_cmd -> Tmp_file.reset ~rc:rc_content reset_cmd default_n
-              | None ->
-       (* Else: Run the nth command *)
-       sprintf "Default: run nth command: %s"
-         (match num_cmd with None -> "None"
-            | Some n -> "Some " ^ (Int.to_string n)) |> Messages.debug;
-       Default.run ~rc:rc_content num_cmd
-    )
+           reset_cmd |> (function
+             | Some reset_cmd -> Tmp_file.reset ~rc:rc_content reset_cmd default_n
+             | None -> ());
+
+           (* Else: Run the nth command *)
+           sprintf "Default: run nth command: %s"
+             (match num_cmd with None -> "None"
+                | Some n -> "Some " ^ (Int.to_string n)) |> Messages.debug;
+           Default.run ~rc:rc_content num_cmd;
+           Messages.debug "Default: end"
+         end
+        )
 ;;
 ;;