| ... | @@ -7032,6 +7032,7 @@ const usage_fetch = | ... | @@ -7032,6 +7032,7 @@ const usage_fetch = |
| 7032 | \\Options: | 7032 | \\Options: |
| 7033 | \\ -h, --help Print this help and exit | 7033 | \\ -h, --help Print this help and exit |
| 7034 | \\ --global-cache-dir [path] Override path to global Zig cache directory | 7034 | \\ --global-cache-dir [path] Override path to global Zig cache directory |
| | 7035 | \\ --pkg-dir [path] Override path to package directory |
| 7035 | \\ --debug-hash Print verbose hash information to stdout | 7036 | \\ --debug-hash Print verbose hash information to stdout |
| 7036 | \\ --save Add the fetched package to build.zig.zon | 7037 | \\ --save Add the fetched package to build.zig.zon |
| 7037 | \\ --save=[name] Add the fetched package to build.zig.zon as name | 7038 | \\ --save=[name] Add the fetched package to build.zig.zon as name |
| ... | @@ -7052,6 +7053,7 @@ fn cmdFetch( | ... | @@ -7052,6 +7053,7 @@ fn cmdFetch( |
| 7052 | const color: Color = .auto; | 7053 | const color: Color = .auto; |
| 7053 | var opt_path_or_url: ?[]const u8 = null; | 7054 | var opt_path_or_url: ?[]const u8 = null; |
| 7054 | var override_global_cache_dir: ?[]const u8 = EnvVar.ZIG_GLOBAL_CACHE_DIR.get(environ_map); | 7055 | var override_global_cache_dir: ?[]const u8 = EnvVar.ZIG_GLOBAL_CACHE_DIR.get(environ_map); |
| | 7056 | var override_pkg_dir: ?[]const u8 = null; |
| 7055 | var debug_hash: bool = false; | 7057 | var debug_hash: bool = false; |
| 7056 | var save: union(enum) { | 7058 | var save: union(enum) { |
| 7057 | no, | 7059 | no, |
| ... | @@ -7071,6 +7073,10 @@ fn cmdFetch( | ... | @@ -7071,6 +7073,10 @@ fn cmdFetch( |
| 7071 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); | 7073 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 7072 | i += 1; | 7074 | i += 1; |
| 7073 | override_global_cache_dir = args[i]; | 7075 | override_global_cache_dir = args[i]; |
| | 7076 | } else if (mem.eql(u8, arg, "--pkg-dir")) { |
| | 7077 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| | 7078 | i += 1; |
| | 7079 | override_pkg_dir = args[i]; |
| 7074 | } else if (mem.eql(u8, arg, "--debug-hash")) { | 7080 | } else if (mem.eql(u8, arg, "--debug-hash")) { |
| 7075 | debug_hash = true; | 7081 | debug_hash = true; |
| 7076 | } else if (mem.eql(u8, arg, "--save")) { | 7082 | } else if (mem.eql(u8, arg, "--save")) { |
| ... | @@ -7132,7 +7138,7 @@ fn cmdFetch( | ... | @@ -7132,7 +7138,7 @@ fn cmdFetch( |
| 7132 | .local_cache = local_cache_path, | 7138 | .local_cache = local_cache_path, |
| 7133 | .root_pkg_path = .{ | 7139 | .root_pkg_path = .{ |
| 7134 | .root_dir = build_root.directory, | 7140 | .root_dir = build_root.directory, |
| 7135 | .sub_path = "zig-pkg", | 7141 | .sub_path = override_pkg_dir orelse "zig-pkg", |
| 7136 | }, | 7142 | }, |
| 7137 | .recursive = false, | 7143 | .recursive = false, |
| 7138 | .read_only = false, | 7144 | .read_only = false, |