hostapps/src/main.zig

85 lines
3.2 KiB
Zig
Raw Normal View History

2024-01-12 22:47:10 -06:00
const std = @import("std");
const builtin = @import("builtin");
const build_options = @import("build_options");
2024-01-28 20:20:37 -06:00
const cli = @import("zig-cli");
const options = @import("options.zig");
2024-05-14 15:23:31 -05:00
const connect = @import("connect.zig");
const update = @import("update.zig");
2024-01-12 22:47:10 -06:00
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = gpa.allocator();
2024-01-28 20:20:37 -06:00
options.options.alloc = alloc;
2024-01-12 22:47:10 -06:00
2024-05-14 15:23:31 -05:00
var r = try cli.AppRunner.init(alloc);
const app = cli.App{
.command = cli.Command{
.name = "hostapps",
.description = cli.Description{
.one_line = "hostapps",
},
.target = cli.CommandTarget{
.subcommands = &.{
cli.Command{
.name = "connect",
.description = cli.Description{
.one_line = "connect",
},
.options = &.{
cli.Option{
.long_name = "config",
.help = "config file",
.value_ref = r.mkRef(&options.options.config),
.required = true,
},
cli.Option{
.long_name = "identity",
.help = "ssh identity",
.value_ref = r.mkRef(&options.options.identities),
},
cli.Option{
.long_name = "proxy-jump",
.help = "proxy jump",
.value_ref = r.mkRef(&options.options.proxy_jump),
},
cli.Option{
.long_name = "ssh-command",
.help = "ssh command",
.value_ref = r.mkRef(&options.options.ssh_path),
},
cli.Option{
.long_name = "telnet-command",
.help = "telnet command",
.value_ref = r.mkRef(&options.options.telnet_path),
},
},
.target = cli.CommandTarget{
.action = cli.CommandAction{
.exec = connect.connect,
},
},
},
cli.Command{
.name = "update",
.description = cli.Description{
.one_line = "update",
},
.options = &.{},
.target = cli.CommandTarget{
.action = cli.CommandAction{
.exec = update.update,
},
},
},
},
},
},
.version = "0.1.0",
.author = "Jeffrey C. Ollie <jcollie@dmacc.edu>",
};
return r.run(&app);
2024-01-12 22:47:10 -06:00
}