get config file location from cli

This commit is contained in:
Jeffrey C. Ollie 2023-10-14 22:42:27 -05:00
parent 37c6c791a1
commit 303d5c66b6
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -85,7 +85,16 @@ pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
const config = try readConfig(allocator, "config.json");
var args = std.process.args();
_ = args.skip();
const config_path = args.next();
const config = blk: {
break :blk if (config_path) |path| try readConfig(allocator, path) else try readConfig(allocator, "config.json");
};
defer config.deinit();
const b64 = std.base64.standard.Encoder;