╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
198 var stdout_writer = std.Io.File.stdout().writer(io, &.{}); 199 var stderr_writer = std.Io.File.stderr().writer(io, &.{}); 200 const run_opts = hx.main.RunOpts{ .out = &stdout_writer.interface, .err = &stderr_writer.interface }; 201 202 const Runnable = struct { 203 io: std.Io, 204 205 pub fn run(self: @This()) !void { 206 std.debug.print( 207 \\ 208 \\connect to the TUI with: 209 \\ ssh -p 8022 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null localhost 210 \\ 211 \\create a git repo and push over SSH: 212 \\ mkdir -p temp-try/client/test 213 \\ cd temp-try/client/test 214 \\ git init 215 \\ echo "hello" > hello.txt 216 \\ git add hello.txt 217 \\ git commit -m "let there be light" 218 \\ GIT_SSH_COMMAND='ssh -p 8022 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' git push localhost:test HEAD:master 219 \\ 220 \\to quit, press enter. 221 \\ 222 , .{}); 223 // portable stdin read via std.Io — equivalent to the 224 // std.posix.read(STDIN_FILENO, ...) that doesn't compile 225 // on windows. 226 var buf: [1]u8 = undefined; 227 var stdin_reader = std.Io.File.stdin().reader(self.io, &buf); 228 _ = stdin_reader.interface.takeByte() catch {}; 229 } 230 }; 231 232 try srv.run(.xit, .{}, io, allocator, cwd_path, .{ 233 .data_dir = server_path, 234 }, run_opts.err, Runnable{ .io = io }); 235 } else { 236 var null_writer = std.Io.Writer.Discarding.init(&.{}); 237 const run_opts = hx.main.RunOpts{ .out = &null_writer.writer, .err = &null_writer.writer }; 238 239 const Runnable = struct { 240 io: std.Io, 241 allocator: std.mem.Allocator, 242 page: *const ui.Page, 243 session: *ui.Session, 244 245 pub fn run(self: @This()) !void { 246 // launch the TUI 247 try hx.ui.run(self.io, self.allocator, self.page, self.session); 248 } 249 }; 250 251 try srv.run(.xit, .{}, io, allocator, cwd_path, .{ 252 .data_dir = server_path, 253 }, run_opts.err, Runnable{ .io = io, .allocator = allocator, .page = &page, .session = &session }); 254 } 255 } 256