From 01398787a634c479812373e27e8ffd14a0440afd Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 24 Jul 2021 02:46:21 -0700 Subject: [PATCH] cmd/aq/add- change to add source git dep instead of http dep --- src/cmd/aquila/add.zig | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/cmd/aquila/add.zig b/src/cmd/aquila/add.zig index ed92415443dc31a70f0f67f42de32d758fb1fc4a..e57b791e6bdc9e32eab9a114e673cdd469630010 100644 --- a/src/cmd/aquila/add.zig +++ b/src/cmd/aquila/add.zig @@ -13,33 +13,14 @@ pub fn execute(args: [][]u8) !void { const url = try std.mem.join(gpa, "/", &.{ aq.server_root, pkg_id }); const val = try aq.server_fetch(url); - const name = val.get(.{ "pkg", "name" }).?.String; - - const versions = val.get("versions").?.Array; - const to_add = versions[versions.len - 1]; - - const self_module = try u.ModFile.init(gpa, "zig.mod"); - for (self_module.deps) |dep| { - if (std.mem.eql(u8, dep.name, name)) { - std.log.warn("dependency with name '{s}' already exists in your dependencies", .{name}); - } - } - for (self_module.devdeps) |dep| { - if (std.mem.eql(u8, dep.name, name)) { - std.log.warn("dependency with name '{s}' already exists in your dependencies", .{name}); - } - } - const file = try std.fs.cwd().openFile("zig.mod", .{ .read = true, .write = true }); try file.seekTo(try file.getEndPos()); - const v_hash = to_add.get("tar_hash").?.String; - const v_maj = to_add.get("real_major").?.Int; - const v_min = to_add.get("real_minor").?.Int; - const file_w = file.writer(); - try file_w.print("\n", .{}); - try file_w.print(" - src: http {s}/v{d}.{d}.tar.gz {s} {d} {d}\n", .{ url, v_maj, v_min, v_hash[0..20], v_maj, v_min }); + try file_w.print(" - src: git https://{s}/{s}\n", .{ + val.get(.{ "repo", "domain" }).?.String, + val.get(.{ "pkg", "remote_name" }).?.String, + }); std.log.info("Successfully added package {s}", .{pkg_id}); } -- 2.54.0