Lightpanda: the headless browser designed for AI and automation
`lp.update` -> `lp.checkVersion` + honor `--check` in `version`
Halil Durak8673fbb489ff
diff --git a/src/lightpanda.zig b/src/lightpanda.zigindex f7ec92c8b..b9e9d9cc6 100644--- a/src/lightpanda.zig+++ b/src/lightpanda.zig@@ -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);}diff --git a/src/main.zig b/src/main.zigindex ca0b75325..4799eb3ef 100644--- a/src/main.zig+++ b/src/main.zig@@ -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) {