lp.update -> lp.checkVersion + honor --check in version

This commit is contained in:
Halil Durak
2026-07-03 12:44:18 +03:00
parent d8184dc462
commit 8673fbb489
2 changed files with 8 additions and 6 deletions

View File

@@ -225,8 +225,7 @@ fn dumpContent(app: *App, mode: Config.DumpFormat, dump_opts: dump.Opts, frame:
}
}
/// Check `Config.zig` for `options`.
pub fn update(allocator: std.mem.Allocator, config: *const Config) !void {
pub fn checkVersion(allocator: std.mem.Allocator, config: *const Config) !void {
var client = try Updater.init(allocator, config);
defer client.deinit();
@@ -234,7 +233,6 @@ pub fn update(allocator: std.mem.Allocator, config: *const Config) !void {
var buf: [4096]u8 = undefined;
var writer = stdout.writer(&buf);
const w = &writer.interface;
// Inform to stdout about version.
try client.inform(w);
}

View File

@@ -71,9 +71,13 @@ fn run(allocator: Allocator, main_arena: Allocator) !void {
switch (args.mode) {
.help => |tag| return args.printUsageAndExit(tag, true),
.version => {
var stdout = std.fs.File.stdout().writer(&.{});
try stdout.interface.print("{s}\n", .{lp.build_config.version});
.version => |opts| {
if (opts.check) {
try lp.checkVersion(allocator, &args);
} else {
var stdout = std.fs.File.stdout().writer(&.{});
try stdout.interface.print("{s}\n", .{lp.build_config.version});
}
return std.process.cleanExit();
},
.agent => |opts| if (opts.list_models) {