diff --git a/src/cmd/zpm.zig b/src/cmd/zpm.zig index b9a0e287689541de50c85c3847799ed87984f0e5..033689b81098d8d40dfd814d9431c9503c5ce841 100644 --- a/src/cmd/zpm.zig +++ b/src/cmd/zpm.zig @@ -17,6 +17,15 @@ pub const commands = struct { pub const server_root = "https://zpm.random-projects.net/api"; +pub const Package = struct { + author: []const u8, + name: []const u8, + tags: [][]const u8, + git: []const u8, + root_file: ?[]const u8, + description: []const u8, +}; + pub fn execute(args: [][]u8) !void { if (args.len == 0) { std.debug.warn("{s}\n", .{ diff --git a/src/cmd/zpm_add.zig b/src/cmd/zpm_add.zig index 2d2836570ea3d9d62f793cf4160a1ef4e8316ec7..4a66aed85a5e9f7334cabf345ca8201a21e4e5d7 100644 --- a/src/cmd/zpm_add.zig +++ b/src/cmd/zpm_add.zig @@ -4,21 +4,11 @@ const gpa = std.heap.c_allocator; const zfetch = @import("zfetch"); const u = @import("./../util/index.zig"); +const zpm = @import("./zpm.zig"); // // -pub const Zpm = struct { - pub const Package = struct { - author: []const u8, - name: []const u8, - tags: [][]const u8, - git: []const u8, - root_file: ?[]const u8, - description: []const u8, - }; -}; - pub fn execute(args: [][]u8) !void { const url = "https://zpm.random-projects.net/api/packages"; @@ -30,7 +20,7 @@ pub fn execute(args: [][]u8) !void { const body_content = try r.readAllAlloc(gpa, std.math.maxInt(usize)); var stream = std.json.TokenStream.init(body_content); - const val = try std.json.parse([]Zpm.Package, &stream, .{ .allocator = gpa }); + const val = try std.json.parse([]zpm.Package, &stream, .{ .allocator = gpa }); const found = blk: { for (val) |pkg| {