╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ try.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
274 const Runnable = struct { 275 io: std.Io, 276 key_path: []const u8, 277 278 pub fn run(self: @This()) !void { 279 std.debug.print( 280 \\ 281 \\connect to the TUI with: 282 \\ ssh -p 8022 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null localhost 283 \\ 284 \\create a git repo and push over SSH: 285 \\ mkdir -p temp-try/client/test 286 \\ cd temp-try/client/test 287 \\ git init 288 \\ echo "hello" > hello.txt 289 \\ git add hello.txt 290 \\ git commit -m "let there be light" 291 \\ 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 292 \\ 293 \\to quit, press enter. 294 \\ 295 , .{self.key_path}); 296 // portable stdin read via std.Io — equivalent to the 297 // std.posix.read(STDIN_FILENO, ...) that doesn't compile 298 // on windows. 299 var buf: [1]u8 = undefined; 300 var stdin_reader = std.Io.File.stdin().reader(self.io, &buf); 301 _ = stdin_reader.interface.takeByte() catch {}; 302 } 303 }; 304 305 try srv.run(.xit, .{}, io, allocator, cwd_path, .{ 306 .data_dir = server_path, 307 }, run_opts.err, Runnable{ .io = io, .key_path = key_path }); 308 } else { 309 var null_writer = std.Io.Writer.Discarding.init(&.{}); 310 const run_opts = hx.main.RunOpts{ .out = &null_writer.writer, .err = &null_writer.writer }; 311 312 const Runnable = struct { 313 io: std.Io, 314 allocator: std.mem.Allocator, 315 session: *ui.Session, 316 317 pub fn run(self: @This()) !void { 318 // launch the TUI 319 try hx.ui.run(self.io, self.allocator, self.session); 320 } 321 }; 322 323 try srv.run(.xit, .{}, io, allocator, cwd_path, .{ 324 .data_dir = server_path, 325 }, run_opts.err, Runnable{ .io = io, .allocator = allocator, .session = &session }); 326 } 327 } 328