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.

progress

+275
+5
bin/dune
··· 1 + (executable 2 + (public_name jj_tui) 3 + (name main) 4 + (libraries jj_tui feather lwd nottui base core stdio core_unix.command_unix ) 5 + )
+85
bin/main.ml
··· 1 + open Nottui;; 2 + open Feather;; 3 + open Lwd_infix;; 4 + module W = Nottui_widgets;; 5 + 6 + 7 + (* Ui_loop.run (Lwd.pure (W.printf "Hello world"));; *) 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 13 + stdout^stderr 14 + 15 + 16 + let vcount = Lwd.var "";; 17 + 18 + let button = 19 + W.button (Printf.sprintf "run jj" ) 20 + (fun () -> vcount $= (runCommand())) 21 + |>Lwd.pure 22 + ;; 23 + let vQuit=Lwd.var false;; 24 + 25 + let quitButton = 26 + W.button (Printf.sprintf "quit " ) 27 + (fun () -> vQuit $= true) 28 + |>Lwd.pure 29 + ;; 30 + 31 + 32 + let (<-$) f v=Lwd.map ~f (Lwd.get v);; 33 + 34 + let inputs ui= 35 + Ui.event_filter (fun event-> 36 + match event with 37 + |`Key (`ASCII 'l',_)-> 38 + let res=runCommand()in 39 + vcount$=res; 40 + 41 + `Handled 42 + |_->`Unhandled 43 + ) ui 44 + ;; 45 + let mainUi= 46 + Lwd.map ~f:inputs @@Nottui_widgets.vbox [ 47 + button; 48 + W.string <-$ vcount; 49 + quitButton] 50 + ;; 51 + 52 + 53 + Ui_loop.run ~quit:vQuit (mainUi);; 54 + 55 + (* 56 + type tree = Tree of string * (unit -> tree list) 57 + 58 + let rec tree_ui (Tree (label, child)) = 59 + let opened = Lwd.var false in 60 + let render is_opened = 61 + let btn_text = if is_opened then "[-] " else "[+] " in 62 + let btn_action () = Lwd.set opened (not is_opened) in 63 + let btn = W.button (btn_text ^ label) btn_action in 64 + let layout node forest = 65 + Ui.join_y node (Ui.join_x (Ui.space 2 0) forest) 66 + in 67 + if is_opened 68 + then Lwd.map ~f:(layout btn) (forest_ui (child ())) 69 + else Lwd.pure btn 70 + in 71 + Lwd.join (Lwd.map ~f:render (Lwd.get opened)) 72 + 73 + and forest_ui nodes = 74 + Lwd_utils.pack Ui.pack_y 75 + (List.map tree_ui nodes) 76 + ;; 77 + 78 + let rec fake_fs () = [ 79 + Tree ("bin", fake_fs); 80 + Tree ("home", fake_fs); 81 + Tree ("usr", fake_fs); 82 + ] in 83 + 84 + Ui_loop.run (forest_ui (fake_fs ()));; 85 + *)
+26
dune-project
··· 1 + (lang dune 3.9) 2 + 3 + (name jj_tui) 4 + 5 + (generate_opam_files true) 6 + 7 + (source 8 + (github username/reponame)) 9 + 10 + (authors "Author Name") 11 + 12 + (maintainers "Maintainer Name") 13 + 14 + (license LICENSE) 15 + 16 + (documentation https://url/to/documentation) 17 + 18 + (package 19 + (name jj_tui) 20 + (synopsis "A short synopsis") 21 + (description "A longer description") 22 + (depends ocaml dune) 23 + (tags 24 + (topics "to describe" your project))) 25 + 26 + ; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
+24
flake.lock
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1713344939, 6 + "narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=", 7 + "path": "/nix/store/ngm8a5avsnfk266jha4j5xy93xfhjasf-source", 8 + "rev": "e402c3eb6d88384ca6c52ef1c53e61bdc9b84ddd", 9 + "type": "path" 10 + }, 11 + "original": { 12 + "id": "nixpkgs", 13 + "type": "indirect" 14 + } 15 + }, 16 + "root": { 17 + "inputs": { 18 + "nixpkgs": "nixpkgs" 19 + } 20 + } 21 + }, 22 + "root": "root", 23 + "version": 7 24 + }
+52
flake.nix
··· 1 + { 2 + description = "Example JavaScript development environment for Zero to Nix"; 3 + 4 + # Flake inputs 5 + inputs = { 6 + 7 + # nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 8 + nixpkgs.url = "nixpkgs"; # also valid: "nixpkgs" 9 + 10 + # roc={ 11 + # url="github:roc-lang/roc"; 12 + # inputs.nixpkgs.follows="nixpkgs"; 13 + 14 + # }; 15 + 16 + }; 17 + # Flake outputs 18 + outputs = { self, nixpkgs, ... }@inputs: 19 + let 20 + # Systems supported 21 + allSystems = [ 22 + "x86_64-linux" # 64-bit Intel/AMD Linux 23 + ]; 24 + 25 + # Helper to provide system-specific attributes 26 + forAllSystems = f: 27 + nixpkgs.lib.genAttrs allSystems (system: 28 + f { 29 + pkgs = import nixpkgs { inherit system; }; 30 + 31 + }); 32 + in { 33 + # Development environment output 34 + devShells = forAllSystems ({ pkgs }: { 35 + default = 36 + 37 + pkgs.mkShell { 38 + packages = with pkgs; [ pkgs.pkg-config gmp stdenv.cc.cc.lib ]; 39 + shellHook = let 40 + libPath = 41 + pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib pkgs.gmp ]; 42 + in '' 43 + # yolo 44 + export CFLAGS="$CFLAGS -I${pkgs.stdenv.cc.cc.lib}/include -I${pkgs.gmp}/include" 45 + export LIBS="$LIBS -L${pkgs.stdenv.cc.cc.lib}/lib -L${pkgs.gmp}/lib" 46 + ''; 47 + }; 48 + 49 + }); 50 + 51 + }; 52 + }
+8
jj_tui.install
··· 1 + lib: [ 2 + "_build/install/default/lib/jj_tui/META" 3 + "_build/install/default/lib/jj_tui/dune-package" 4 + "_build/install/default/lib/jj_tui/opam" 5 + ] 6 + bin: [ 7 + "_build/install/default/bin/jj_tui" 8 + ]
+31
jj_tui.opam
··· 1 + # This file is generated by dune, edit dune-project instead 2 + opam-version: "2.0" 3 + synopsis: "A short synopsis" 4 + description: "A longer description" 5 + maintainer: ["Maintainer Name"] 6 + authors: ["Author Name"] 7 + license: "LICENSE" 8 + tags: ["topics" "to describe" "your" "project"] 9 + homepage: "https://github.com/username/reponame" 10 + doc: "https://url/to/documentation" 11 + bug-reports: "https://github.com/username/reponame/issues" 12 + depends: [ 13 + "ocaml" 14 + "dune" {>= "3.9"} 15 + "odoc" {with-doc} 16 + ] 17 + build: [ 18 + ["dune" "subst"] {dev} 19 + [ 20 + "dune" 21 + "build" 22 + "-p" 23 + name 24 + "-j" 25 + jobs 26 + "@install" 27 + "@runtest" {with-test} 28 + "@doc" {with-doc} 29 + ] 30 + ] 31 + dev-repo: "git+https://github.com/username/reponame.git"
+5
lib/dune
··· 1 + (library 2 + (name jj_tui) 3 + (libraries core stdio core_unix.command_unix ) 4 + ) 5 +
+37
lib/process.ml
··· 1 + 2 + let mk_home_cmd cmd = 3 + let home_dir = Unix.getenv "HOME" in 4 + Printf.sprintf "HOME=%s %s" home_dir cmd 5 + 6 + let proc_silent cmd = 7 + let _exit_code = Unix.system (mk_home_cmd cmd) in 8 + () 9 + 10 + let proc cmd = 11 + Printf.eprintf "🐚 %s\n%!" cmd; 12 + proc_silent cmd 13 + 14 + let collect_chan (channel : in_channel) : string = 15 + let rec loop acc = 16 + match input_line channel with 17 + | exception End_of_file -> acc 18 + | line -> loop (acc ^ line ^ "\n") 19 + in 20 + loop "" 21 + 22 + let proc_stdout cmd = 23 + let ((proc_stdout, _proc_stdin, _proc_stderr) as process) = 24 + Unix.open_process_full (mk_home_cmd cmd) [||] 25 + in 26 + let stdout_result = collect_chan proc_stdout in 27 + let _ = Unix.close_process_full process in 28 + String.trim stdout_result 29 + 30 + let proc_stdOutAndErr cmd = 31 + let ((proc_stdout, _proc_stdin, proc_stderr) as process) = 32 + Unix.open_process_full (mk_home_cmd cmd) [||] 33 + in 34 + let stdout_result = collect_chan proc_stdout in 35 + let stderr_result = collect_chan proc_stderr in 36 + let _ = Unix.close_process_full process in 37 + String.trim (stdout_result^stderr_result)
+2
test/dune
··· 1 + (test 2 + (name jj_tui))
test/jj_tui.ml

This is a binary file and will not be displayed.