diff --git a/README.md b/README.md index 4a25058a705b988a330fb2090267841aa7d9beb6..75129a9b63dfad30936b37609e707cdc41f52e05 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,8 @@ id: t5ch3nfmdaa25ndlch7ucz7yztq8n1iaanv2d7iwiw4q5n65 name: my_app main: src/main.zig dependencies: -- type: git - path: https://github.com/Hejsil/zig-clap -- type: git - path: https://github.com/alexnask/ctregex.zig +- src: git https://github.com/Hejsil/zig-clap +- src: git https://github.com/alexnask/ctregex.zig # ctregex.zig doesn't have a zig.mod file so we can manually # define its entry point. this can also be used generally to # override any attribute we want in this dependency. @@ -124,6 +122,7 @@ dependencies: |------|------|------|-------------| | `type` | `string` | required, enum | One of `system_lib`, `git`, `hg`, `http` | | `path` | `string` | required | URL/path to this dependency. depends on the type | +| `src` | `string` | Shorthand for the format `type path`. | | `version` | `string` | only on some types | pin this dependency at a specific version | | `only_os` | `string` | | comma separated list of OS names to add this Dep to | | `except_os` | `string` | | comma separated list of OS names to exclude this Dep from | diff --git a/src/util/modfile.zig b/src/util/modfile.zig index 3ca9779ee40221264b3cc48ffd7b1eb2756aa0ae..f0b03e7f474e2b910d1c058f1280f7b12a0dabd4 100644 --- a/src/util/modfile.zig +++ b/src/util/modfile.zig @@ -38,8 +38,16 @@ pub const ModFile = struct { if (doc.mapping.get("dependencies")) |dep_seq| { if (dep_seq == .sequence) { for (dep_seq.sequence) |item| { - const dtype = item.mapping.get("type").?.string; - const path = item.mapping.get("path").?.string; + var dtype: []const u8 = undefined; + var path: []const u8 = undefined; + if (item.mapping.get("src")) |val| { + var src_iter = std.mem.split(val.string, " "); + dtype = src_iter.next().?; + path = src_iter.next().?; + } else { + dtype = item.mapping.get("type").?.string; + path = item.mapping.get("path").?.string; + } const dep_type = std.meta.stringToEnum(u.DepType, dtype).?; try dep_list.append(u.Dep{