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.

progrsee

+26 -15
+26 -15
bin/main.ml
··· 6 6 7 7 (* Ui_loop.run (Lwd.pure (W.printf "Hello world"));; *) 8 8 9 - let runCommand ()= 10 - (* sys.Command.exec *) 11 - (* let res=Jj_tui.Process.proc_stdOutAndErr "jj --no-pager help" in *) 12 - let (stdout,stderr)=Feather.process "jj" []|>Feather.collect stdout_and_stderr in 9 + let cmdArgs cmd args= 10 + let (stdout,stderr)=Feather.process cmd args|>Feather.collect stdout_and_stderr in 11 + stdout^stderr 12 + ;; 13 + let cmd cmd = 14 + let (stdout,stderr)=Feather.process cmd []|>Feather.collect stdout_and_stderr in 13 15 stdout^stderr 14 16 15 - let ()= 16 - (* sys.Command.exec *) 17 - (* let res=Jj_tui.Process.proc_stdOutAndErr "jj --no-pager help" in *) 18 - let (stdout,stderr)=Feather.process "jj" []|>Feather.collect stdout_and_stderr in 19 - stdout^stderr 17 + ;; 20 18 21 19 22 20 let vcount = Lwd.var "";; 23 21 24 22 let button = 25 23 W.button (Printf.sprintf "run jj" ) 26 - (fun () -> vcount $= (runCommand())) 24 + (fun () -> vcount $= (cmd"jj")) 27 25 |>Lwd.pure 28 26 ;; 29 27 let vQuit=Lwd.var false;; ··· 36 34 37 35 38 36 let (<-$) f v=Lwd.map ~f (Lwd.get v);; 39 - 37 + let vShowStatus= Lwd.var "";; 40 38 let inputs ui= 41 39 Ui.event_filter (fun event-> 42 40 match event with 43 41 |`Key (`ASCII 'l',_)-> 44 - let res=runCommand()in 42 + let res=cmd "jj"in 45 43 vcount$=res; 46 44 47 45 `Handled 46 + |`Key (`ASCII 's',_)-> 47 + let res=cmdArgs "jj" ["show"]in 48 + vShowStatus$=res; 49 + 50 + `Handled 51 + |`Key (`ASCII 'p',_)-> 52 + let _=cmdArgs "jj"["prev"]in 53 + 54 + `Handled 55 + |`Key (`ASCII 'n',_)-> 56 + let _=cmdArgs "jj "["next"]in 57 + 58 + `Handled 48 59 |_->`Unhandled 49 60 ) ui 50 61 ;; 51 62 let mainUi= 52 63 Lwd.map ~f:inputs @@ 53 64 W.h_pane 54 - Nottui_widgets.vbox [ 65 + (Nottui_widgets.vbox [ 55 66 button; 56 67 W.string <-$ vcount; 57 - quitButton] 58 - W.string 68 + quitButton]) 69 + (W.string <-$ vShowStatus) 59 70 ;; 60 71 61 72