zig fetch: add --save flag

```
--save        Add the fetched package to build.zig.zon
--save=[name] Add the fetched package to build.zig.zon as name
```
This commit is contained in:
Andrew Kelley
2023-11-26 17:04:28 -07:00
parent a0c8d54823
commit 0c0b69891a
3 changed files with 347 additions and 111 deletions

View File

@@ -15,8 +15,7 @@
// Once all dependencies are fetched, `zig build` no longer requires
// Internet connectivity.
.dependencies = .{
// A future version of Zig will provide a `zig add <url>` subcommand
// for easily adding dependencies.
// See `zig fetch --save <url>` for a command-line interface for adding dependencies.
//.example = .{
// // When updating this field to a new URL, be sure to delete the corresponding
// // `hash`, otherwise you are communicating that you expect to find the old hash at
@@ -36,7 +35,7 @@
//
// // When this is provided, the package is found in a directory relative to the
// // build root. In this case the package's hash is irrelevant and therefore not
// // computed.
// // computed. This field and `url` are mutually exclusive.
// .path = "foo",
//},
},
@@ -57,5 +56,7 @@
//"build.zig",
//"build.zig.zon",
//"src",
//"LICENSE",
//"README.md",
},
}