terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

added a check to ensure we are inside a jj repo

+38 -22
+2 -1
jj_tui/bin/global_funcs.ml
··· 20 20 the start ") 21 21 else None) 22 22 ;; 23 - 23 + let is_jj_repo() = 24 + jj_no_log ~color:false [ "log";"''" ] |> Base.String.is_substring ~substring:"There is no jj repo"|>not 24 25 (**Updates the status windows; Without snapshotting the working copy by default 25 26 This should be called after any command that performs a change *) 26 27 let update_status ?(cause_snapshot = false) () =
+36 -21
jj_tui/bin/jj_ui.ml
··· 107 107 108 108 let mainUi ~sw env = 109 109 (*we want to initialize our states and keep them up to date*) 110 - update_status ~cause_snapshot:true (); 111 - Eio.Fiber.fork_daemon ~sw (fun _ -> 112 - let clock = Eio.Stdenv.clock env in 113 - while true do 114 - Eio.Time.sleep clock 5.0; 115 - (*we need to lock this becasue we could end up updating while the ui is rendering*) 116 - Vars.render_mutex |> Eio.Mutex.lock; 117 - update_status ~cause_snapshot:true (); 118 - Vars.render_mutex |> Eio.Mutex.unlock 119 - done; 120 - `Stop_daemon); 121 - let$* running = Lwd.get ui_state.view in 122 - match running with 123 - | `Cmd_I cmd -> 124 - (*We have this extra step to paint the terminal empty for one step*) 125 - Lwd.set ui_state.view @@ `RunCmd cmd; 126 - full_term_sized_background 127 - | `RunCmd cmd -> 128 - Jj_widgets.interactive_process env ("jj" :: cmd) 129 - | `Main -> 130 - main_view ~sw 110 + let is_jj_repo = is_jj_repo () in 111 + if not is_jj_repo 112 + then 113 + W.string "Not in a jj repo." 114 + |> Lwd.pure 115 + |> Wd.border_box 116 + |>$ Ui.resize 117 + ~sw:1 118 + ~sh:1 119 + ~mw:10000 120 + ~mh:10000 121 + ~crop:Wd.neutral_grav 122 + ~pad:Wd.neutral_grav 123 + |> inputs 124 + else ( 125 + update_status ~cause_snapshot:true (); 126 + Eio.Fiber.fork_daemon ~sw (fun _ -> 127 + let clock = Eio.Stdenv.clock env in 128 + while true do 129 + Eio.Time.sleep clock 5.0; 130 + (*we need to lock this becasue we could end up updating while the ui is rendering*) 131 + Vars.render_mutex |> Eio.Mutex.lock; 132 + update_status ~cause_snapshot:true (); 133 + Vars.render_mutex |> Eio.Mutex.unlock 134 + done; 135 + `Stop_daemon); 136 + let$* running = Lwd.get ui_state.view in 137 + match running with 138 + | `Cmd_I cmd -> 139 + (*We have this extra step to paint the terminal empty for one step*) 140 + Lwd.set ui_state.view @@ `RunCmd cmd; 141 + full_term_sized_background 142 + | `RunCmd cmd -> 143 + Jj_widgets.interactive_process env ("jj" :: cmd) 144 + | `Main -> 145 + main_view ~sw) 131 146 ;; 132 147 end