get config file location from cli
This commit is contained in:
parent
37c6c791a1
commit
303d5c66b6
1 changed files with 10 additions and 1 deletions
11
src/main.zig
11
src/main.zig
|
@ -85,7 +85,16 @@ pub fn main() !void {
|
||||||
|
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
const allocator = gpa.allocator();
|
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();
|
defer config.deinit();
|
||||||
|
|
||||||
const b64 = std.base64.standard.Encoder;
|
const b64 = std.base64.standard.Encoder;
|
||||||
|
|
Loading…
Reference in a new issue