cli/version: don't parse any args

Fixes #2166
This commit is contained in:
Mitchell Hashimoto
2024-08-31 10:39:01 -07:00
parent f7d1fb8ba0
commit f1aea10a84

View File

@ -4,31 +4,10 @@ const builtin = @import("builtin");
const build_config = @import("../build_config.zig");
const xev = @import("xev");
const renderer = @import("../renderer.zig");
const args = @import("args.zig");
const Action = @import("action.zig").Action;
pub const Options = struct {
pub fn deinit(self: Options) void {
_ = self;
}
/// Enables `-h` and `--help` to work.
pub fn help(self: Options) !void {
_ = self;
return Action.help_error;
}
};
/// The `version` command is used to display information about Ghostty.
pub fn run(alloc: Allocator) !u8 {
var opts: Options = .{};
defer opts.deinit();
{
var iter = try std.process.argsWithAllocator(alloc);
defer iter.deinit();
try args.parse(Options, alloc, &opts, &iter);
}
_ = alloc;
const stdout = std.io.getStdOut().writer();
try stdout.print("Ghostty {s}\n\n", .{build_config.version_string});