From ee49da6f224b00d86868cd6e60018a1525540bad Mon Sep 17 00:00:00 2001 From: Medvidek77 Date: Wed, 2 Apr 2025 18:46:55 +0200 Subject: [PATCH] Update src/main.zig --- src/main.zig | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main.zig b/src/main.zig index b2a347c..9aa9f8d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,24 +1,27 @@ const std = @import("std"); -const url = @import("url.zig"); +const url = @import("url.zig"); const json = @import("json.zig"); + const dbg_print = std.debug.print; +const eql = std.mem.eql; + pub fn main() !void { // gpa allocator var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer _ = gpa.deinit(); + defer _ = gpa.deinit(); const allocator = gpa.allocator(); - var args = try std.process.argsWithAllocator(allocator); - defer args.deinit(); + const args = try std.process.argsAlloc(allocator); + defer std.process.argsFree(allocator, args); - while (args.next()) |arg| { - dbg_print("{s}", .{arg}); + if (eql(u8, args[1], "help")) { + dbg_print("Help :)\n", .{}); } - - const data = try url.fetch(allocator, "https://tidal.401658.xyz/track/?id=286266927&quality=LOSSLESS"); - defer allocator.free(data); + + const data = try url.fetch(allocator, "https://tidal.401658.xyz/track/?id=286266927&quality=LOSSLESS"); + defer allocator.free(data); try json.extract(allocator, data); -} +} \ No newline at end of file