╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────╮ │1 const std = @import("std"); │ │2 const srv = @import("./serve.zig"); │ │3 -const ssh = @import("./ssh_git.zig"); │ │4 -const ssh_tui = @import("./ssh_tui.zig");│ │3 │ │4 pub const CommandKind = enum { │ │5 serve, │ ╰────────────────────────────────────────────╯ ╭────────────────────────╮ │8 - ssh_git, │ │9 - ssh_tui, │ │6 }; │ │7 │ │8 const Help = struct {│ ╰────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │17 .name = "serve", │ │18 .descrip = │ │19 \\a long-running server forwarding receive-pack and upload-pack. │ │24 - , │ │25 - .example = │ │26 - \\haxy serve --http-listen 127.0.0.1:8080 --ssh-listen 127.0.0.1:8081 --tui-listen 127.0.0.1:8082 --wui-listen 127.0.0.1:8000 --data-dir /srv/git│ │27 - , │ │28 - }, │ │29 - .ssh_git => .{ │ │30 - .name = "ssh-git", │ │31 - .descrip = │ │32 - \\a helper run by sshd that forwards Git SSH service requests to serve. │ │33 - , │ │34 - .example = │ │35 - \\haxy ssh-git --ssh-connect 127.0.0.1:8081 --service upload-pack <directory> │ │36 - , │ │37 - }, │ │38 - .ssh_tui => .{ │ │39 - .name = "ssh-tui", │ │40 - .descrip = │ │41 - \\a helper run by sshd that forwards a TUI session to serve over a raw byte stream. │ │20 , │ │21 .example = │ │44 - \\haxy ssh-tui --tui-connect 127.0.0.1:8082 --user-key SHA256:... │ │22 + \\haxy serve --http-listen 127.0.0.1:8080 --ssh-listen 127.0.0.1:8022 --wui-listen 127.0.0.1:8000 --data-dir /srv/git │ │23 , │ │24 }, │ │25 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │ 84 const value_flags = std.StaticStringMap(void).initComptime(.{ │ │ 85 .{"--http-listen"}, │ │ 86 .{"--ssh-listen"}, │ │109 - .{"--tui-listen"}, │ │ 87 .{"--wui-listen"}, │ │111 - .{"--ssh-connect"}, │ │112 - .{"--tui-connect"}, │ │113 - .{"--user-key"}, │ │ 88 .{"--data-dir"}, │ │115 - .{"--service"}, │ │ 89 }); │ │ 90 │ │ 91 pub fn init(allocator: std.mem.Allocator, args: []const []const u8) !CommandArgs {│ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │177 /// if any additional allocation needs to be done, the arena inside the cmd args will be used.│ │178 pub const Command = union(CommandKind) { │ │179 serve: srv.Options, │ │207 - ssh_git: ssh.Options, │ │208 - ssh_tui: ssh_tui.Options, │ │180 │ │181 pub fn initMaybe(cmd_args: *CommandArgs) !?Command { │ │182 const command_kind = cmd_args.command_kind orelse return null; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────╮ │192 if (cmd_args.get("--ssh-listen")) |val_maybe| { │ │193 options.ssh_listen = val_maybe orelse return error.SshListenNeedsValue;│ │194 } │ │224 - if (cmd_args.get("--tui-listen")) |val_maybe| { │ │225 - options.tui_listen = val_maybe orelse return error.TuiListenNeedsValue;│ │226 - } │ │195 if (cmd_args.get("--wui-listen")) |val_maybe| { │ │196 options.wui_listen = val_maybe orelse return error.WuiListenNeedsValue;│ │197 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │201 │ │202 return .{ .serve = options }; │ │203 }, │ │236 - .ssh_git => { │ │237 - if (cmd_args.positional_args.len > 1) return null; │ │238 - │ │239 - var options: ssh.Options = .{}; │ │240 - │ │241 - if (cmd_args.get("--ssh-connect")) |val_maybe| { │ │242 - options.ssh_connect = val_maybe orelse return error.SshConnectNeedsValue; │ │243 - } │ │244 - if (cmd_args.get("--service")) |val_maybe| { │ │245 - options.service = val_maybe orelse return error.ServiceNeedsValue; │ │246 - } │ │247 - options.dir = if (cmd_args.positional_args.len == 1) cmd_args.positional_args[0] else null;│ │248 - │ │249 - return .{ .ssh_git = options }; │ │250 - }, │ │251 - .ssh_tui => { │ │252 - if (cmd_args.positional_args.len != 0) return null; │ │253 - │ │254 - var options: ssh_tui.Options = .{}; │ │255 - │ │256 - if (cmd_args.get("--tui-connect")) |val_maybe| { │ │257 - options.tui_connect = val_maybe orelse return error.TuiConnectNeedsValue; │ │258 - } │ │259 - if (cmd_args.get("--user-key")) |val_maybe| { │ │260 - options.user_key = val_maybe orelse return error.UserKeyNeedsValue; │ │261 - } │ │262 - │ │263 - return .{ .ssh_tui = options }; │ │264 - }, │ │204 } │ │205 } │ │206 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯