╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
328 key_path: []const u8, 329 330 pub fn run(self: @This()) !void { 331 std.debug.print( 332 \\ 333 \\connect to the TUI with: 334 \\ ssh -p 8022 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null localhost 335 \\ 336 \\create a git repo and push over SSH: 337 \\ mkdir -p temp-try/client/test 338 \\ cd temp-try/client/test 339 \\ git init 340 \\ echo "hello" > hello.txt 341 \\ git add hello.txt 342 \\ git commit -m "let there be light" 343 \\ GIT_SSH_COMMAND='ssh -p 8022 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i {s}' git push localhost:admin/test HEAD:master 344 \\ 345 \\to quit, press enter. 346 \\ 347 , .{self.key_path}); 348 // portable stdin read via std.Io — equivalent to the 349 // std.posix.read(STDIN_FILENO, ...) that doesn't compile 350 // on windows. 351 var buf: [1]u8 = undefined; 352 var stdin_reader = std.Io.File.stdin().reader(self.io, &buf); 353 _ = stdin_reader.interface.takeByte() catch {}; 354 } 355 }; 356 357 try srv.run(.xit, .{}, io, allocator, cwd_path, .{ 358 .data_dir = server_path, 359 }, run_opts.err, Runnable{ .io = io, .key_path = key_path }); 360 } else { 361 var null_writer = std.Io.Writer.Discarding.init(&.{}); 362 const run_opts = hx.main.RunOpts{ .out = &null_writer.writer, .err = &null_writer.writer }; 363 364 const Runnable = struct { 365 io: std.Io, 366 allocator: std.mem.Allocator, 367 session: *ui.Session, 368 369 pub fn run(self: @This()) !void { 370 // launch the TUI 371 try hx.ui.run(self.io, self.allocator, self.session); 372 } 373 }; 374 375 try srv.run(.xit, .{}, io, allocator, cwd_path, .{ 376 .data_dir = server_path, 377 }, run_opts.err, Runnable{ .io = io, .allocator = allocator, .session = &session }); 378 } 379 } 380