| ... | ... | @@ -4,21 +4,11 @@ const gpa = std.heap.c_allocator; |
| 4 | 4 | const zfetch = @import("zfetch"); |
| 5 | 5 | |
| 6 | 6 | const u = @import("./../util/index.zig"); |
| 7 | const zpm = @import("./zpm.zig"); |
| 7 | 8 | |
| 8 | 9 | // |
| 9 | 10 | // |
| 10 | 11 | |
| 11 | | pub const Zpm = struct { |
| 12 | | pub const Package = struct { |
| 13 | | author: []const u8, |
| 14 | | name: []const u8, |
| 15 | | tags: [][]const u8, |
| 16 | | git: []const u8, |
| 17 | | root_file: ?[]const u8, |
| 18 | | description: []const u8, |
| 19 | | }; |
| 20 | | }; |
| 21 | | |
| 22 | 12 | pub fn execute(args: [][]u8) !void { |
| 23 | 13 | const url = "https://zpm.random-projects.net/api/packages"; |
| 24 | 14 | |
| ... | ... | @@ -30,7 +20,7 @@ pub fn execute(args: [][]u8) !void { |
| 30 | 20 | |
| 31 | 21 | const body_content = try r.readAllAlloc(gpa, std.math.maxInt(usize)); |
| 32 | 22 | var stream = std.json.TokenStream.init(body_content); |
| 33 | | const val = try std.json.parse([]Zpm.Package, &stream, .{ .allocator = gpa }); |
| 23 | const val = try std.json.parse([]zpm.Package, &stream, .{ .allocator = gpa }); |
| 34 | 24 | |
| 35 | 25 | const found = blk: { |
| 36 | 26 | for (val) |pkg| { |