aboutsummaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/create_command.zig126
-rw-r--r--src/cli/install_completions_command.zig20
-rw-r--r--src/cli/package_manager_command.zig18
-rw-r--r--src/cli/run_command.zig42
-rw-r--r--src/cli/test_command.zig6
-rw-r--r--src/cli/upgrade_command.zig70
6 files changed, 142 insertions, 140 deletions
diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig
index 43494c893..c2b08bc99 100644
--- a/src/cli/create_command.zig
+++ b/src/cli/create_command.zig
@@ -87,7 +87,7 @@ const UnsupportedPackages = struct {
pub fn print(this: UnsupportedPackages) void {
inline for (comptime std.meta.fieldNames(UnsupportedPackages)) |field_name| {
if (@field(this, field_name)) {
- Output.prettyErrorln("<r><yellow>warn<r><d>:<r> <b>\"{any}\"<r> won't work in bun yet\n", .{field_name});
+ Output.prettyErrorln("<r><yellow>warn<r><d>:<r> <b>\"{s}\"<r> won't work in bun yet\n", .{field_name});
}
}
}
@@ -132,9 +132,9 @@ fn execTask(allocator: std.mem.Allocator, task_: string, cwd: string, _: string,
Output.pretty("\n<r><d>$<b>", .{});
for (argv) |arg, i| {
if (i > argv.len - 1) {
- Output.print(" {any} ", .{arg});
+ Output.print(" {s} ", .{arg});
} else {
- Output.print(" {any}", .{arg});
+ Output.print(" {s}", .{arg});
}
}
Output.pretty("<r>", .{});
@@ -285,7 +285,7 @@ pub const CreateCommand = struct {
var outdir_path_ = home_dir_buf[0..outdir_path.len :0];
std.fs.accessAbsoluteZ(outdir_path_, .{}) catch break :outer;
if (create_options.verbose) {
- Output.prettyErrorln("reading from {any}", .{outdir_path});
+ Output.prettyErrorln("reading from {s}", .{outdir_path});
}
example_tag = Example.Tag.local_folder;
break :brk outdir_path;
@@ -299,7 +299,7 @@ pub const CreateCommand = struct {
var outdir_path_ = home_dir_buf[0..outdir_path.len :0];
std.fs.accessAbsoluteZ(outdir_path_, .{}) catch break :outer;
if (create_options.verbose) {
- Output.prettyErrorln("reading from {any}", .{outdir_path});
+ Output.prettyErrorln("reading from {s}", .{outdir_path});
}
example_tag = Example.Tag.local_folder;
break :brk outdir_path;
@@ -313,7 +313,7 @@ pub const CreateCommand = struct {
var outdir_path_ = home_dir_buf[0..outdir_path.len :0];
std.fs.accessAbsoluteZ(outdir_path_, .{}) catch break :outer;
if (create_options.verbose) {
- Output.prettyErrorln("reading from {any}", .{outdir_path});
+ Output.prettyErrorln("reading from {s}", .{outdir_path});
}
example_tag = Example.Tag.local_folder;
break :brk outdir_path;
@@ -379,7 +379,7 @@ pub const CreateCommand = struct {
const destination = try filesystem.dirname_store.append([]const u8, resolve_path.joinAbs(filesystem.top_level_dir, .auto, dirname));
var progress = std.Progress{};
- var node = progress.start(try ProgressBuf.print("Loading {any}", .{template}), 0);
+ var node = progress.start(try ProgressBuf.print("Loading {s}", .{template}), 0);
progress.supports_ansi_escape_codes = Output.enable_ansi_colors_stderr;
// alacritty is fast
@@ -399,7 +399,7 @@ pub const CreateCommand = struct {
var package_json_file: ?std.fs.File = null;
if (create_options.verbose) {
- Output.prettyErrorln("Downloading as {any}\n", .{@tagName(example_tag)});
+ Output.prettyErrorln("Downloading as {s}\n", .{@tagName(example_tag)});
}
switch (example_tag) {
@@ -411,7 +411,7 @@ pub const CreateCommand = struct {
node.end();
progress.refresh();
- Output.prettyError("\n<r><red>error:<r> <b>\"{any}\"<r> was not found. Here are templates you can use:\n\n", .{
+ Output.prettyError("\n<r><red>error:<r> <b>\"{s}\"<r> was not found. Here are templates you can use:\n\n", .{
template,
});
Output.flush();
@@ -444,7 +444,7 @@ pub const CreateCommand = struct {
node.end();
progress.refresh();
- Output.prettyError("\n<r><red>error:<r> <b>\"{any}\"<r> was not found on GitHub. Here are templates you can use:\n\n", .{
+ Output.prettyError("\n<r><red>error:<r> <b>\"{s}\"<r> was not found on GitHub. Here are templates you can use:\n\n", .{
template,
});
Output.flush();
@@ -466,7 +466,7 @@ pub const CreateCommand = struct {
else => unreachable,
};
- node.name = try ProgressBuf.print("Decompressing {any}", .{template});
+ node.name = try ProgressBuf.print("Decompressing {s}", .{template});
node.setCompletedItems(0);
node.setEstimatedTotalItems(0);
@@ -479,7 +479,7 @@ pub const CreateCommand = struct {
try gunzip.readAll();
gunzip.deinit();
- node.name = try ProgressBuf.print("Extracting {any}", .{template});
+ node.name = try ProgressBuf.print("Extracting {s}", .{template});
node.setCompletedItems(0);
node.setEstimatedTotalItems(0);
@@ -516,21 +516,21 @@ pub const CreateCommand = struct {
// Thank you create-react-app for this copy (and idea)
Output.prettyErrorln(
- "<r>\n<red>error<r><d>: <r>The directory <b><blue>{any}<r>/ contains files that could conflict:\n\n",
+ "<r>\n<red>error<r><d>: <r>The directory <b><blue>{s}<r>/ contains files that could conflict:\n\n",
.{
std.fs.path.basename(destination),
},
);
for (archive_context.overwrite_list.keys()) |path| {
if (strings.endsWith(path, std.fs.path.sep_str)) {
- Output.prettyError("<r> <blue>{any}<r>", .{path[0 .. std.math.max(path.len, 1) - 1]});
+ Output.prettyError("<r> <blue>{s}<r>", .{path[0 .. std.math.max(path.len, 1) - 1]});
Output.prettyErrorln(std.fs.path.sep_str, .{});
} else {
- Output.prettyErrorln("<r> {any}", .{path});
+ Output.prettyErrorln("<r> {s}", .{path});
}
}
- Output.prettyErrorln("<r>\n<d>To download {any} anyway, use --force<r>", .{template});
+ Output.prettyErrorln("<r>\n<d>To download {s} anyway, use --force<r>", .{template});
Global.exit(1);
}
}
@@ -568,7 +568,7 @@ pub const CreateCommand = struct {
node.end();
progress.refresh();
- Output.prettyErrorln("<r><red>{any}<r>: opening dir {any}", .{ @errorName(err), template });
+ Output.prettyErrorln("<r><red>{s}<r>: opening dir {s}", .{ @errorName(err), template });
Global.exit(1);
};
@@ -578,7 +578,7 @@ pub const CreateCommand = struct {
progress.refresh();
- Output.prettyErrorln("<r><red>{any}<r>: creating dir {any}", .{ @errorName(err), destination });
+ Output.prettyErrorln("<r><red>{s}<r>: creating dir {s}", .{ @errorName(err), destination });
Global.exit(1);
};
@@ -605,14 +605,14 @@ pub const CreateCommand = struct {
progress_.refresh();
- Output.prettyErrorln("<r><red>{any}<r>: copying file {any}", .{ @errorName(err), entry.path });
+ Output.prettyErrorln("<r><red>{s}<r>: copying file {s}", .{ @errorName(err), entry.path });
Global.exit(1);
};
};
defer outfile.close();
defer node_.completeOne();
- var infile = try entry.dir.openFile(entry.basename, .{ .mode = .read_only });
+ var infile = try entry.dir.dir.openFile(entry.basename, .{ .mode = .read_only });
defer infile.close();
// Assumption: you only really care about making sure something that was executable is still executable
@@ -620,12 +620,12 @@ pub const CreateCommand = struct {
_ = C.fchmod(outfile.handle, stat.mode);
CopyFile.copy(infile.handle, outfile.handle) catch {
- entry.dir.copyFile(entry.basename, destination_dir_, entry.path, .{}) catch |err| {
+ entry.dir.dir.copyFile(entry.basename, destination_dir_, entry.path, .{}) catch |err| {
node_.end();
progress_.refresh();
- Output.prettyErrorln("<r><red>{any}<r>: copying file {any}", .{ @errorName(err), entry.path });
+ Output.prettyErrorln("<r><red>{s}<r>: copying file {s}", .{ @errorName(err), entry.path });
Global.exit(1);
};
};
@@ -633,9 +633,9 @@ pub const CreateCommand = struct {
}
};
- try FileCopier.copy(destination_dir, &walker_, node, &progress);
+ try FileCopier.copy(destination_dir.dir, &walker_, node, &progress);
- package_json_file = destination_dir.openFile("package.json", .{ .mode = .read_write }) catch null;
+ package_json_file = destination_dir.dir.openFile("package.json", .{ .mode = .read_write }) catch null;
read_package_json: {
if (package_json_file) |pkg| {
@@ -645,7 +645,7 @@ pub const CreateCommand = struct {
progress.refresh();
package_json_file = null;
- Output.prettyErrorln("Error reading package.json: <r><red>{any}", .{@errorName(err)});
+ Output.prettyErrorln("Error reading package.json: <r><red>{s}", .{@errorName(err)});
break :read_package_json;
};
@@ -666,7 +666,7 @@ pub const CreateCommand = struct {
progress.refresh();
- Output.prettyErrorln("Error reading package.json: <r><red>{any}", .{@errorName(err)});
+ Output.prettyErrorln("Error reading package.json: <r><red>{s}", .{@errorName(err)});
break :read_package_json;
};
// The printer doesn't truncate, so we must do so manually
@@ -1280,7 +1280,7 @@ pub const CreateCommand = struct {
create_react_app_entry_point_path = std.fmt.allocPrint(
ctx.allocator,
- "./{any}",
+ "./{s}",
.{
std.mem.trimLeft(
@@ -1292,7 +1292,7 @@ pub const CreateCommand = struct {
) catch break :bail;
html_writer.print(
- "<script type=\"module\" async src=\"/{any}\"></script>\n{any}",
+ "<script type=\"module\" async src=\"/{s}\"></script>\n{s}",
.{
create_react_app_entry_point_path[2..],
public_index_file_contents[body_closing_tag..],
@@ -1321,7 +1321,7 @@ pub const CreateCommand = struct {
std.os.ftruncate(public_index_html_file.handle, outfile.len + 1) catch break :bail;
bun_bun_for_react_scripts = true;
is_create_react_app = true;
- Output.prettyln("<r><d>[package.json] Added entry point {any} to public/index.html", .{create_react_app_entry_point_path});
+ Output.prettyln("<r><d>[package.json] Added entry point {s} to public/index.html", .{create_react_app_entry_point_path});
}
}
@@ -1352,7 +1352,7 @@ pub const CreateCommand = struct {
strings.contains(script, "react-scripts eject"))
{
if (create_options.verbose) {
- Output.prettyErrorln("<r><d>[package.json] Pruned unnecessary script: {any}<r>", .{script});
+ Output.prettyErrorln("<r><d>[package.json] Pruned unnecessary script: {s}<r>", .{script});
}
continue;
@@ -1451,7 +1451,7 @@ pub const CreateCommand = struct {
var package_json_writer = JSPrinter.NewFileWriter(package_json_file.?);
const written = JSPrinter.printJSON(@TypeOf(package_json_writer), package_json_writer, package_json_expr, &source) catch |err| {
- Output.prettyErrorln("package.json failed to write due to error {any}", .{@errorName(err)});
+ Output.prettyErrorln("package.json failed to write due to error {s}", .{@errorName(err)});
package_json_file = null;
break :process_package_json;
};
@@ -1462,7 +1462,7 @@ pub const CreateCommand = struct {
if (needs.bun_bun_for_nextjs) {
try postinstall_tasks.append(ctx.allocator, InjectionPrefill.bun_bun_for_nextjs_task);
} else if (bun_bun_for_react_scripts) {
- try postinstall_tasks.append(ctx.allocator, try std.fmt.allocPrint(ctx.allocator, "bun bun {any}", .{create_react_app_entry_point_path}));
+ try postinstall_tasks.append(ctx.allocator, try std.fmt.allocPrint(ctx.allocator, "bun bun {s}", .{create_react_app_entry_point_path}));
}
}
}
@@ -1505,12 +1505,12 @@ pub const CreateCommand = struct {
const start_time = std.time.nanoTimestamp();
const install_args = &[_]string{ npm_client.bin, "install" };
Output.flush();
- Output.pretty("\n<r><d>$ <b><cyan>{any}<r><d> install", .{@tagName(npm_client.tag)});
+ Output.pretty("\n<r><d>$ <b><cyan>{s}<r><d> install", .{@tagName(npm_client.tag)});
if (install_args.len > 2) {
for (install_args[2..]) |arg| {
Output.pretty(" ", .{});
- Output.pretty("{any}", .{arg});
+ Output.pretty("{s}", .{arg});
}
}
@@ -1523,7 +1523,7 @@ pub const CreateCommand = struct {
defer {
Output.printErrorln("\n", .{});
Output.printStartEnd(start_time, std.time.nanoTimestamp());
- Output.prettyError(" <r><d>{any} install<r>\n", .{@tagName(npm_client.tag)});
+ Output.prettyError(" <r><d>{s} install<r>\n", .{@tagName(npm_client.tag)});
Output.flush();
Output.print("\n", .{});
@@ -1547,7 +1547,7 @@ pub const CreateCommand = struct {
Output.printError("\n", .{});
Output.printStartEnd(ctx.start_time, std.time.nanoTimestamp());
- Output.prettyErrorln(" <r><d>bun create {any}<r>", .{template});
+ Output.prettyErrorln(" <r><d>bun create {s}<r>", .{template});
Output.flush();
@@ -1604,13 +1604,13 @@ pub const CreateCommand = struct {
Output.pretty(
\\
- \\<b><green>Success!<r> <b>{any}<r> loaded into <b>{any}<r>
+ \\<b><green>Success!<r> <b>{s}<r> loaded into <b>{s}<r>
\\
, .{ display_name, std.fs.path.basename(destination) });
} else {
Output.pretty(
\\
- \\<b>Created <green>{any}<r> project successfully
+ \\<b>Created <green>{s}<r> project successfully
\\
, .{std.fs.path.basename(template)});
}
@@ -1628,7 +1628,7 @@ pub const CreateCommand = struct {
\\
\\<r><d>#<r> When dependencies change, run this to update node_modules.bun:
\\
- \\ <b><cyan>bun bun {any}<r>
+ \\ <b><cyan>bun bun {s}<r>
\\
, .{create_react_app_entry_point_path});
}
@@ -1637,8 +1637,8 @@ pub const CreateCommand = struct {
\\
\\<d>#<r><b> To get started, run:<r>
\\
- \\ <b><cyan>cd {any}<r>
- \\ <b><cyan>{any}<r>
+ \\ <b><cyan>cd {s}<r>
+ \\ <b><cyan>{s}<r>
\\
\\
, .{
@@ -1698,16 +1698,16 @@ pub const Example = struct {
var app_name_buf: [512]u8 = undefined;
pub fn print(examples: []const Example, default_app_name: ?string) void {
for (examples) |example| {
- var app_name = default_app_name orelse (std.fmt.bufPrint(&app_name_buf, "./{any}-app", .{example.name[0..std.math.min(example.name.len, 492)]}) catch unreachable);
+ var app_name = default_app_name orelse (std.fmt.bufPrint(&app_name_buf, "./{s}-app", .{example.name[0..std.math.min(example.name.len, 492)]}) catch unreachable);
if (example.description.len > 0) {
- Output.pretty(" <r># {any}<r>\n <b>bun create <cyan>{any}<r><b> {any}<r>\n<d> \n\n", .{
+ Output.pretty(" <r># {s}<r>\n <b>bun create <cyan>{s}<r><b> {s}<r>\n<d> \n\n", .{
example.description,
example.name,
app_name,
});
} else {
- Output.pretty(" <r><b>bun create <cyan>{any}<r><b> {any}<r>\n\n", .{
+ Output.pretty(" <r><b>bun create <cyan>{s}<r><b> {s}<r>\n\n", .{
example.name,
app_name,
});
@@ -1721,28 +1721,28 @@ pub const Example = struct {
var examples = std.ArrayList(Example).fromOwnedSlice(ctx.allocator, remote_examples);
{
- var folders = [3]std.fs.IterableDir{ std.fs.Dir{ .fd = 0 }, std.fs.Dir{ .fd = 0 }, std.fs.Dir{ .fd = 0 } };
+ var folders = [3]std.fs.IterableDir{ .{.dir = .{ .fd = 0 }}, .{.dir = .{ .fd = 0 }}, .{.dir = .{ .fd = 0 }} };
if (env_loader.map.get("BUN_CREATE_DIR")) |home_dir| {
var parts = [_]string{home_dir};
var outdir_path = filesystem.absBuf(&parts, &home_dir_buf);
- folders[0] = std.fs.openIterableDirAbsolute(outdir_path, .{}) catch std.fs.Dir{ .fd = 0 };
+ folders[0] = std.fs.openIterableDirAbsolute(outdir_path, .{}) catch .{.dir = .{ .fd = 0 }};
}
{
var parts = [_]string{ filesystem.top_level_dir, BUN_CREATE_DIR };
var outdir_path = filesystem.absBuf(&parts, &home_dir_buf);
- folders[1] = std.fs.openIterableDirAbsolute(outdir_path, .{}) catch std.fs.Dir{ .fd = 0 };
+ folders[1] = std.fs.openIterableDirAbsolute(outdir_path, .{}) catch .{.dir = .{ .fd = 0 }};
}
if (env_loader.map.get("HOME")) |home_dir| {
var parts = [_]string{ home_dir, BUN_CREATE_DIR };
var outdir_path = filesystem.absBuf(&parts, &home_dir_buf);
- folders[2] = std.fs.openIterableDirAbsolute(outdir_path, .{}) catch std.fs.Dir{ .fd = 0 };
+ folders[2] = std.fs.openIterableDirAbsolute(outdir_path, .{}) catch .{.dir = .{ .fd = 0 }};
}
// subfolders with package.json
for (folders) |folder_| {
- if (folder_.fd != 0) {
+ if (folder_.dir.fd != 0) {
const folder: std.fs.IterableDir = folder_;
var iter = folder.iterate();
@@ -1764,7 +1764,7 @@ pub const Example = struct {
var path: [:0]u8 = home_dir_buf[0 .. entry.name.len + 1 + "package.json".len :0];
- folder.accessZ(path, .{ .mode = .read_only }) catch continue :loop;
+ folder.dir.accessZ(path, .{ .mode = .read_only }) catch continue :loop;
try examples.append(
Example{
@@ -1802,7 +1802,7 @@ pub const Example = struct {
repository = repository[0..i];
}
- progress.name = try ProgressBuf.pretty("<d>[github] <b>GET<r> <blue>{any}/{any}<r>", .{ owner, repository });
+ progress.name = try ProgressBuf.pretty("<d>[github] <b>GET<r> <blue>{s}/{s}<r>", .{ owner, repository });
refresher.refresh();
var github_api_domain: string = "api.github.com";
@@ -1815,7 +1815,7 @@ pub const Example = struct {
var api_url = URL.parse(
try std.fmt.bufPrint(
&github_repository_url_buf,
- "https://{any}/repos/{any}/{any}/tarball",
+ "https://{s}/repos/{s}/{s}/tarball",
.{ github_api_domain, owner, repository },
),
);
@@ -1825,7 +1825,7 @@ pub const Example = struct {
if (env_loader.map.get("GITHUB_ACCESS_TOKEN")) |access_token| {
if (access_token.len > 0) {
- headers_buf = try std.fmt.allocPrint(ctx.allocator, "Access-TokenBearer {any}", .{access_token});
+ headers_buf = try std.fmt.allocPrint(ctx.allocator, "Access-TokenBearer {s}", .{access_token});
try header_entries.append(
ctx.allocator,
Headers.Kv{
@@ -1887,7 +1887,7 @@ pub const Example = struct {
refresher.refresh();
if (content_type.len > 0) {
- Output.prettyErrorln("<r><red>error<r>: Unexpected content type from GitHub: {any}", .{content_type});
+ Output.prettyErrorln("<r><red>error<r>: Unexpected content type from GitHub: {s}", .{content_type});
Global.crash();
} else {
Output.prettyErrorln("<r><red>error<r>: Invalid response from GitHub (missing content type)", .{});
@@ -1914,7 +1914,7 @@ pub const Example = struct {
var mutable = try ctx.allocator.create(MutableString);
mutable.* = try MutableString.init(ctx.allocator, 2048);
- url = URL.parse(try std.fmt.bufPrint(&url_buf, "https://registry.npmjs.org/@bun-examples/{any}/latest", .{name}));
+ url = URL.parse(try std.fmt.bufPrint(&url_buf, "https://registry.npmjs.org/@bun-examples/{s}/latest", .{name}));
// ensure very stable memory address
var async_http: *HTTP.AsyncHTTP = ctx.allocator.create(HTTP.AsyncHTTP) catch unreachable;
@@ -1956,7 +1956,7 @@ pub const Example = struct {
}
Global.exit(1);
} else {
- Output.prettyErrorln("Error parsing package: <r><red>{any}<r>", .{@errorName(err)});
+ Output.prettyErrorln("Error parsing package: <r><red>{s}<r>", .{@errorName(err)});
Global.exit(1);
}
};
@@ -2058,14 +2058,14 @@ pub const Example = struct {
Global.exit(1);
},
else => {
- Output.prettyErrorln("<r><red>{any}<r> while trying to fetch examples list. Please try again", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>{s}<r> while trying to fetch examples list. Please try again", .{@errorName(err)});
Global.exit(1);
},
}
};
if (response.status_code != 200) {
- Output.prettyErrorln("<r><red>{d}<r> fetching examples :( {any}", .{ response.status_code, mutable.list.items });
+ Output.prettyErrorln("<r><red>{d}<r> fetching examples :( {s}", .{ response.status_code, mutable.list.items });
Global.exit(1);
}
@@ -2080,7 +2080,7 @@ pub const Example = struct {
}
Global.exit(1);
} else {
- Output.prettyErrorln("Error parsing examples: <r><red>{any}<r>", .{@errorName(err)});
+ Output.prettyErrorln("Error parsing examples: <r><red>{s}<r>", .{@errorName(err)});
Global.exit(1);
}
};
@@ -2114,7 +2114,7 @@ pub const Example = struct {
}
}
- Output.prettyErrorln("Corrupt examples data: expected object but received {any}", .{@tagName(examples_object.data)});
+ Output.prettyErrorln("Corrupt examples data: expected object but received {s}", .{@tagName(examples_object.data)});
Global.exit(1);
}
};
@@ -2146,7 +2146,7 @@ pub const CreateListExamplesCommand = struct {
if (env_loader.map.get("HOME")) |homedir| {
Output.prettyln(
- "<d>This command is completely optional. To add a new local template, create a folder in {any}/.bun-create/. To publish a new template, git clone https://github.com/oven-sh/bun, add a new folder to the \"examples\" folder, and submit a PR.<r>",
+ "<d>This command is completely optional. To add a new local template, create a folder in {s}/.bun-create/. To publish a new template, git clone https://github.com/oven-sh/bun, add a new folder to the \"examples\" folder, and submit a PR.<r>",
.{homedir},
);
} else {
@@ -2171,7 +2171,7 @@ const GitHandler = struct {
success = std.atomic.Atomic(u32).init(0);
thread = std.Thread.spawn(.{}, spawnThread, .{ destination, PATH, verbose }) catch |err| {
- Output.prettyErrorln("<r><red>{any}<r>", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>{s}<r>", .{@errorName(err)});
Global.exit(1);
};
}
@@ -2233,7 +2233,7 @@ const GitHandler = struct {
};
if (comptime verbose) {
- Output.prettyErrorln("git backend: {any}", .{git});
+ Output.prettyErrorln("git backend: {s}", .{git});
}
// same names, just comptime known values
diff --git a/src/cli/install_completions_command.zig b/src/cli/install_completions_command.zig
index b24800ef1..70a4519a6 100644
--- a/src/cli/install_completions_command.zig
+++ b/src/cli/install_completions_command.zig
@@ -70,7 +70,7 @@ pub const InstallCompletionsCommand = struct {
}
var completions_dir: string = "";
- var output_dir: std.fs.Dir = found: {
+ var output_dir: std.fs.IterableDir = found: {
var cwd_buf: [bun.MAX_PATH_BYTES]u8 = undefined;
var cwd = std.os.getcwd(&cwd_buf) catch {
Output.prettyErrorln("<r><red>error<r>: Could not get current working directory", .{});
@@ -93,14 +93,14 @@ pub const InstallCompletionsCommand = struct {
}
if (!std.fs.path.isAbsolute(completions_dir)) {
- Output.prettyErrorln("<r><red>error:<r> Please pass an absolute path. {any} is invalid", .{completions_dir});
+ Output.prettyErrorln("<r><red>error:<r> Please pass an absolute path. {s} is invalid", .{completions_dir});
Global.exit(fail_exit_code);
}
break :found std.fs.openIterableDirAbsolute(completions_dir, .{
}) catch |err| {
- Output.prettyErrorln("<r><red>error:<r> accessing {any} errored {any}", .{ completions_dir, @errorName(err) });
+ Output.prettyErrorln("<r><red>error:<r> accessing {s} errored {s}", .{ completions_dir, @errorName(err) });
Global.exit(fail_exit_code);
};
}
@@ -302,10 +302,10 @@ pub const InstallCompletionsCommand = struct {
std.debug.assert(completions_dir.len > 0);
- var output_file = output_dir.createFileZ(filename, .{
+ var output_file = output_dir.dir.createFileZ(filename, .{
.truncate = true,
}) catch |err| {
- Output.prettyErrorln("<r><red>error:<r> Could not open {any} for writing: {any}", .{
+ Output.prettyErrorln("<r><red>error:<r> Could not open {s} for writing: {s}", .{
filename,
@errorName(err),
});
@@ -313,7 +313,7 @@ pub const InstallCompletionsCommand = struct {
};
output_file.writeAll(shell.completions()) catch |err| {
- Output.prettyErrorln("<r><red>error:<r> Could not write to {any}: {any}", .{
+ Output.prettyErrorln("<r><red>error:<r> Could not write to {s}: {s}", .{
filename,
@errorName(err),
});
@@ -321,7 +321,7 @@ pub const InstallCompletionsCommand = struct {
};
defer output_file.close();
- output_dir.close();
+ output_dir.dir.close();
// Check if they need to load the zsh completions file into their .zshrc
if (shell == .zsh) {
@@ -394,7 +394,7 @@ pub const InstallCompletionsCommand = struct {
// We need to add it to the end of the file
var remaining = buf[read..];
- var extra = std.fmt.bufPrint(remaining, "\n# bun completions\n[ -s \"{any}\" ] && source \"{any}\"\n", .{
+ var extra = std.fmt.bufPrint(remaining, "\n# bun completions\n[ -s \"{s}\" ] && source \"{s}\"\n", .{
completions_path,
completions_path,
}) catch unreachable;
@@ -406,14 +406,14 @@ pub const InstallCompletionsCommand = struct {
};
if (needs_to_tell_them_to_add_completions_file) {
- Output.prettyErrorln("<r>To enable completions, add this to your .zshrc:\n <b>[ -s \"{any}\" ] && source \"{any}\"", .{
+ Output.prettyErrorln("<r>To enable completions, add this to your .zshrc:\n <b>[ -s \"{s}\" ] && source \"{s}\"", .{
completions_path,
completions_path,
});
}
}
- Output.prettyErrorln("<r><d>Installed completions to {any}/{any}<r>\n", .{
+ Output.prettyErrorln("<r><d>Installed completions to {s}/{s}<r>\n", .{
completions_dir,
filename,
});
diff --git a/src/cli/package_manager_command.zig b/src/cli/package_manager_command.zig
index d81d8cba7..36e062efd 100644
--- a/src/cli/package_manager_command.zig
+++ b/src/cli/package_manager_command.zig
@@ -27,7 +27,7 @@ pub const PackageManagerCommand = struct {
if (load_lockfile == .err) {
if (pm.options.log_level != .silent)
- Output.prettyError("Error loading lockfile: {any}", .{@errorName(load_lockfile.err.value)});
+ Output.prettyError("Error loading lockfile: {s}", .{@errorName(load_lockfile.err.value)});
Global.exit(1);
}
@@ -59,7 +59,7 @@ pub const PackageManagerCommand = struct {
if (strings.eqlComptime(first, "bin")) {
var output_path = Path.joinAbs(Fs.FileSystem.instance.top_level_dir, .auto, std.mem.span(pm.options.bin_path));
- Output.prettyln("{any}", .{output_path});
+ Output.prettyln("{s}", .{output_path});
if (Output.stdout_descriptor_type == .terminal) {
Output.prettyln("\n", .{});
}
@@ -93,7 +93,7 @@ pub const PackageManagerCommand = struct {
if (load_lockfile == .err) {
if (pm.options.log_level != .silent)
- Output.prettyError("Error loading lockfile: {any}", .{@errorName(load_lockfile.err.value)});
+ Output.prettyError("Error loading lockfile: {s}", .{@errorName(load_lockfile.err.value)});
Global.exit(1);
}
@@ -114,7 +114,7 @@ pub const PackageManagerCommand = struct {
if (load_lockfile == .err) {
if (pm.options.log_level != .silent)
- Output.prettyError("Error loading lockfile: {any}", .{@errorName(load_lockfile.err.value)});
+ Output.prettyError("Error loading lockfile: {s}", .{@errorName(load_lockfile.err.value)});
Global.exit(1);
}
@@ -133,7 +133,7 @@ pub const PackageManagerCommand = struct {
if (load_lockfile == .err) {
if (pm.options.log_level != .silent)
- Output.prettyError("Error loading lockfile: {any}", .{@errorName(load_lockfile.err.value)});
+ Output.prettyError("Error loading lockfile: {s}", .{@errorName(load_lockfile.err.value)});
Global.exit(1);
}
@@ -143,16 +143,16 @@ pub const PackageManagerCommand = struct {
var dir: [bun.MAX_PATH_BYTES]u8 = undefined;
var fd = pm.getCacheDirectory();
var outpath = std.os.getFdPath(fd.fd, &dir) catch |err| {
- Output.prettyErrorln("{any} getting cache directory", .{@errorName(err)});
+ Output.prettyErrorln("{s} getting cache directory", .{@errorName(err)});
Global.crash();
};
if (pm.options.positionals.len > 0 and strings.eqlComptime(pm.options.positionals[0], "rm")) {
std.fs.deleteTreeAbsolute(outpath) catch |err| {
- Output.prettyErrorln("{any} deleting cache directory", .{@errorName(err)});
+ Output.prettyErrorln("{s} deleting cache directory", .{@errorName(err)});
Global.crash();
};
- Output.prettyln("Cache directory deleted:\n {any}", .{outpath});
+ Output.prettyln("Cache directory deleted:\n {s}", .{outpath});
Global.exit(0);
}
Output.writer().writeAll(outpath) catch {};
@@ -173,7 +173,7 @@ pub const PackageManagerCommand = struct {
, .{});
if (first.len > 0) {
- Output.prettyErrorln("\n<red>error<r>: \"{any}\" unknown command\n", .{first});
+ Output.prettyErrorln("\n<red>error<r>: \"{s}\" unknown command\n", .{first});
Output.flush();
Global.exit(1);
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig
index 7685f466d..161b1362b 100644
--- a/src/cli/run_command.zig
+++ b/src/cli/run_command.zig
@@ -82,7 +82,7 @@ pub const RunCommand = struct {
}
const BUN_BIN_NAME = if (Environment.isDebug) "bun-debug" else "bun";
- const BUN_RUN = std.fmt.comptimePrint("{any} run", .{BUN_BIN_NAME});
+ const BUN_RUN = std.fmt.comptimePrint("{s} run", .{BUN_BIN_NAME});
// Look for invocations of any:
// - yarn run
@@ -244,7 +244,7 @@ pub const RunCommand = struct {
var child_process = std.ChildProcess.init(&argv, allocator);
if (!silent) {
- Output.prettyErrorln("<r><d><magenta>$<r> <d><b>{any}<r>", .{combined_script});
+ Output.prettyErrorln("<r><d><magenta>$<r> <d><b>{s}<r>", .{combined_script});
Output.flush();
}
@@ -257,13 +257,13 @@ pub const RunCommand = struct {
child_process.stdout_behavior = .Inherit;
const result = child_process.spawnAndWait() catch |err| {
- Output.prettyErrorln("<r><red>error<r>: Failed to run script <b>{any}<r> due to error <b>{any}<r>", .{ name, @errorName(err) });
+ Output.prettyErrorln("<r><red>error<r>: Failed to run script <b>{s}<r> due to error <b>{s}<r>", .{ name, @errorName(err) });
Output.flush();
return true;
};
if (result.Exited > 0) {
- Output.prettyErrorln("<r><red>Script error<r> <b>\"{any}\"<r> exited with {d} status<r>", .{ name, result.Exited });
+ Output.prettyErrorln("<r><red>Script error<r> <b>\"{s}\"<r> exited with {d} status<r>", .{ name, result.Exited });
Output.flush();
Global.exit(result.Exited);
@@ -304,30 +304,30 @@ pub const RunCommand = struct {
const rc = bun.C.stat(std.meta.assumeSentinel(executable, 0), &stat);
if (rc == 0) {
if (std.os.S.ISDIR(stat.mode)) {
- Output.prettyErrorln("<r><red>error<r>: Failed to run directory \"<b>{any}<r>\"\n", .{executable});
+ Output.prettyErrorln("<r><red>error<r>: Failed to run directory \"<b>{s}<r>\"\n", .{executable});
Global.exit(1);
}
}
}
}
- Output.prettyErrorln("<r><red>error<r>: Failed to run \"<b>{any}<r>\" due to error <b>{any}<r>", .{ std.fs.path.basename(executable), @errorName(err) });
+ Output.prettyErrorln("<r><red>error<r>: Failed to run \"<b>{s}<r>\" due to error <b>{s}<r>", .{ std.fs.path.basename(executable), @errorName(err) });
Global.exit(1);
};
switch (result) {
.Exited => |code| {
- Output.prettyErrorln("<r><red>error<r> \"<b>{any}<r>\" exited with {d} status<r>", .{ std.fs.path.basename(executable), code });
+ Output.prettyErrorln("<r><red>error<r> \"<b>{s}<r>\" exited with {d} status<r>", .{ std.fs.path.basename(executable), code });
Global.exit(code);
},
.Signal => |sig| {
- Output.prettyErrorln("<r><red>error<r> \"<b>{any}<r>\" signaled {d}<r>", .{ std.fs.path.basename(executable), sig });
+ Output.prettyErrorln("<r><red>error<r> \"<b>{s}<r>\" signaled {d}<r>", .{ std.fs.path.basename(executable), sig });
Global.exit(1);
},
.Stopped => |sig| {
- Output.prettyErrorln("<r><red>error<r> \"<b>{any}<r>\" stopped: {d}<r>", .{ std.fs.path.basename(executable), sig });
+ Output.prettyErrorln("<r><red>error<r> \"<b>{s}<r>\" stopped: {d}<r>", .{ std.fs.path.basename(executable), sig });
Global.exit(1);
},
.Unknown => |sig| {
- Output.prettyErrorln("<r><red>error<r> \"<b>{any}<r>\" stopped: {d}<r>", .{ std.fs.path.basename(executable), sig });
+ Output.prettyErrorln("<r><red>error<r> \"<b>{s}<r>\" stopped: {d}<r>", .{ std.fs.path.basename(executable), sig });
Global.exit(1);
},
}
@@ -379,7 +379,7 @@ pub const RunCommand = struct {
} else {
ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false) catch {};
}
- Output.prettyErrorln("Error loading directory: \"{any}\"", .{@errorName(err)});
+ Output.prettyErrorln("Error loading directory: \"{s}\"", .{@errorName(err)});
Output.flush();
return err;
} orelse {
@@ -761,7 +761,7 @@ pub const RunCommand = struct {
// "White space after #! is optional."
var shebang_buf: [64]u8 = undefined;
const shebang_size = file.pread(&shebang_buf, 0) catch |err| {
- Output.prettyErrorln("<r><red>error<r>: Failed to read file <b>{any}<r> due to error <b>{any}<r>", .{ file_path, @errorName(err) });
+ Output.prettyErrorln("<r><red>error<r>: Failed to read file <b>{s}<r> due to error <b>{s}<r>", .{ file_path, @errorName(err) });
Global.exit(1);
};
@@ -786,7 +786,7 @@ pub const RunCommand = struct {
ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false) catch {};
}
- Output.prettyErrorln("<r><red>error<r>: Failed to run <b>{any}<r> due to error <b>{any}<r>", .{
+ Output.prettyErrorln("<r><red>error<r>: Failed to run <b>{s}<r> due to error <b>{s}<r>", .{
std.fs.path.basename(file_path),
@errorName(err),
});
@@ -824,11 +824,11 @@ pub const RunCommand = struct {
if (scripts.count() > 0) {
did_print = true;
- Output.prettyln("<r><blue><b>{any}<r> scripts:<r>\n", .{display_name});
+ Output.prettyln("<r><blue><b>{s}<r> scripts:<r>\n", .{display_name});
while (iterator.next()) |entry| {
Output.prettyln("\n", .{});
- Output.prettyln(" bun run <blue>{any}<r>\n", .{entry.key_ptr.*});
- Output.prettyln(" <d> {any}<r>\n", .{entry.value_ptr.*});
+ Output.prettyln(" bun run <blue>{s}<r>\n", .{entry.key_ptr.*});
+ Output.prettyln(" <d> {s}<r>\n", .{entry.value_ptr.*});
}
Output.prettyln("\n<d>{d} scripts<r>", .{scripts.count()});
@@ -837,7 +837,7 @@ pub const RunCommand = struct {
return true;
} else {
- Output.prettyln("<r><blue><b>{any}<r> has no \"scripts\" in package.json.", .{display_name});
+ Output.prettyln("<r><blue><b>{s}<r> has no \"scripts\" in package.json.", .{display_name});
Output.flush();
return true;
}
@@ -845,7 +845,7 @@ pub const RunCommand = struct {
else => {
if (scripts.get(script_name_to_search)) |script_content| {
// allocate enough to hold "post${scriptname}"
- var temp_script_buffer = try std.fmt.allocPrint(ctx.allocator, "ppre{any}", .{script_name_to_search});
+ var temp_script_buffer = try std.fmt.allocPrint(ctx.allocator, "ppre{s}", .{script_name_to_search});
if (scripts.get(temp_script_buffer[1..])) |prescript| {
if (!try runPackageScript(
@@ -918,13 +918,13 @@ pub const RunCommand = struct {
// var file = std.fs.openFileAbsoluteZ(destination, .{ .mode = .read_only }) catch |err| {
// if (!log_errors) return false;
- // Output.prettyErrorln("<r>error: <red>{any}<r> opening file: \"{any}\"", .{ err, std.mem.span(destination) });
+ // Output.prettyErrorln("<r>error: <red>{s}<r> opening file: \"{s}\"", .{ err, std.mem.span(destination) });
// Output.flush();
// return err;
// };
// // var outbuf = std.os.getFdPath(file.handle, &path_buf2) catch |err| {
// // if (!log_errors) return false;
- // // Output.prettyErrorln("<r>error: <red>{any}<r> resolving file: \"{any}\"", .{ err, std.mem.span(destination) });
+ // // Output.prettyErrorln("<r>error: <red>{s}<r> resolving file: \"{s}\"", .{ err, std.mem.span(destination) });
// // Output.flush();
// // return err;
// // };
@@ -943,7 +943,7 @@ pub const RunCommand = struct {
}
if (comptime log_errors) {
- Output.prettyError("<r><red>error:<r> Missing script \"<b>{any}<r>\"\n", .{script_name_to_search});
+ Output.prettyError("<r><red>error:<r> Missing script \"<b>{s}<r>\"\n", .{script_name_to_search});
Global.exit(0);
}
diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig
index 5f11ce889..455f51dbe 100644
--- a/src/cli/test_command.zig
+++ b/src/cli/test_command.zig
@@ -180,7 +180,7 @@ const Scanner = struct {
name: strings.StringOrTinyString,
};
- fn readDirWithName(this: *Scanner, name: string, handle: ?std.fs.Dir) !*FileSystem.RealFS.EntriesOption {
+ fn readDirWithName(this: *Scanner, name: string, handle: ?std.fs.IterableDir) !*FileSystem.RealFS.EntriesOption {
return try this.fs.fs.readDirectoryWithIterator(name, handle, *Scanner, this);
}
@@ -215,9 +215,9 @@ const Scanner = struct {
var path2 = this.fs.absBuf(parts2, &this.open_dir_buf);
this.open_dir_buf[path2.len] = 0;
var pathZ = this.open_dir_buf[path2.len - entry.name.slice().len .. path2.len :0];
- var child_dir = dir.openIterableDirZ(pathZ, .{}) catch continue;
+ var child_dir = bun.openIterableDirZFromDir(dir, pathZ) catch continue;
path2 = this.fs.dirname_store.append(string, path2) catch unreachable;
- FileSystem.setMaxFd(child_dir.fd);
+ FileSystem.setMaxFd(child_dir.dir.fd);
_ = this.readDirWithName(path2, child_dir) catch continue;
}
}
diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig
index 90e3fc376..44230a488 100644
--- a/src/cli/upgrade_command.zig
+++ b/src/cli/upgrade_command.zig
@@ -62,7 +62,7 @@ pub const Version = struct {
return std.fmt.allocPrint(
bun.default_allocator,
- "bun-canary-timestamp-{any}",
+ "bun-canary-timestamp-{s}",
.{
std.fmt.fmtSliceHexLower(
std.mem.asBytes(
@@ -92,7 +92,7 @@ pub const Version = struct {
const current_version: string = "bun-v" ++ Global.package_json_version;
- pub export const Bun__githubURL: [*:0]const u8 = std.fmt.comptimePrint("https://github.com/oven-sh/bun/release/bun-v{any}/{any}", .{
+ pub export const Bun__githubURL: [*:0]const u8 = std.fmt.comptimePrint("https://github.com/oven-sh/bun/release/bun-v{s}/{s}", .{
Global.package_json_version,
zip_filename,
});
@@ -133,7 +133,7 @@ pub const UpgradeCheckerThread = struct {
if (!version.isCurrent()) {
if (version.name()) |name| {
- Output.prettyErrorln("\n<r><d>bun v{any} is out. Run <b><cyan>bun upgrade<r> to upgrade.\n", .{name});
+ Output.prettyErrorln("\n<r><d>bun v{s} is out. Run <b><cyan>bun upgrade<r> to upgrade.\n", .{name});
Output.flush();
}
}
@@ -144,7 +144,7 @@ pub const UpgradeCheckerThread = struct {
fn run(env_loader: *DotEnv.Loader) void {
_run(env_loader) catch |err| {
if (Environment.isDebug) {
- std.debug.print("\n[UpgradeChecker] ERROR: {any}\n", .{@errorName(err)});
+ std.debug.print("\n[UpgradeChecker] ERROR: {s}\n", .{@errorName(err)});
}
};
}
@@ -193,7 +193,7 @@ pub const UpgradeCommand = struct {
var api_url = URL.parse(
try std.fmt.bufPrint(
&github_repository_url_buf,
- "https://{any}/repos/Jarred-Sumner/bun-releases-for-updater/releases/latest",
+ "https://{s}/repos/Jarred-Sumner/bun-releases-for-updater/releases/latest",
.{
github_api_domain,
},
@@ -202,7 +202,7 @@ pub const UpgradeCommand = struct {
if (env_loader.map.get("GITHUB_ACCESS_TOKEN")) |access_token| {
if (access_token.len > 0) {
- headers_buf = try std.fmt.allocPrint(allocator, default_github_headers ++ "Access-TokenBearer {any}", .{access_token});
+ headers_buf = try std.fmt.allocPrint(allocator, default_github_headers ++ "Access-TokenBearer {s}", .{access_token});
try header_entries.append(
allocator,
Headers.Kv{
@@ -262,7 +262,7 @@ pub const UpgradeCommand = struct {
}
Global.exit(1);
} else {
- Output.prettyErrorln("Error parsing releases from GitHub: <r><red>{any}<r>", .{@errorName(err)});
+ Output.prettyErrorln("Error parsing releases from GitHub: <r><red>{s}<r>", .{@errorName(err)});
Global.exit(1);
}
}
@@ -294,7 +294,7 @@ pub const UpgradeCommand = struct {
refresher.refresh();
const json_type: js_ast.Expr.Tag = @as(js_ast.Expr.Tag, expr.data);
- Output.prettyErrorln("JSON error - expected an object but received {any}", .{@tagName(json_type)});
+ Output.prettyErrorln("JSON error - expected an object but received {s}", .{@tagName(json_type)});
Global.exit(1);
}
@@ -312,7 +312,7 @@ pub const UpgradeCommand = struct {
progress.end();
refresher.refresh();
- Output.prettyErrorln("JSON Error parsing releases from GitHub: <r><red>tag_name<r> is missing?\n{any}", .{metadata_body.list.items});
+ Output.prettyErrorln("JSON Error parsing releases from GitHub: <r><red>tag_name<r> is missing?\n{s}", .{metadata_body.list.items});
Global.exit(1);
}
@@ -327,7 +327,7 @@ pub const UpgradeCommand = struct {
if (asset.asProperty("content_type")) |content_type| {
const content_type_ = (content_type.expr.asString(allocator)) orelse continue;
if (comptime Environment.isDebug) {
- Output.prettyln("Content-type: {any}", .{content_type_});
+ Output.prettyln("Content-type: {s}", .{content_type_});
Output.flush();
}
@@ -338,7 +338,7 @@ pub const UpgradeCommand = struct {
if (name_.expr.asString(allocator)) |name| {
if (comptime Environment.isDebug) {
const filename = if (!use_profile) Version.zip_filename else Version.profile_zip_filename;
- Output.prettyln("Comparing {any} vs {any}", .{ name, filename });
+ Output.prettyln("Comparing {s} vs {s}", .{ name, filename });
Output.flush();
}
@@ -347,7 +347,7 @@ pub const UpgradeCommand = struct {
version.zip_url = (asset.asProperty("browser_download_url") orelse break :get_asset).expr.asString(allocator) orelse break :get_asset;
if (comptime Environment.isDebug) {
- Output.prettyln("Found Zip {any}", .{version.zip_url});
+ Output.prettyln("Found Zip {s}", .{version.zip_url});
Output.flush();
}
@@ -366,7 +366,7 @@ pub const UpgradeCommand = struct {
progress.end();
refresher.refresh();
if (version.name()) |name| {
- Output.prettyErrorln("bun v{any} is out, but not for this platform ({any}) yet.", .{
+ Output.prettyErrorln("bun v{s} is out, but not for this platform ({s}) yet.", .{
name, Version.triplet,
});
}
@@ -383,7 +383,7 @@ pub const UpgradeCommand = struct {
@setCold(true);
_exec(ctx) catch |err| {
- Output.prettyErrorln("<r>bun upgrade failed with error: <red><b>{any}<r>\n\n<cyan>Please upgrade manually<r>:\n <b>curl -fsSL https://bun.sh/install | bash<r>\n\n", .{@errorName(err)});
+ Output.prettyErrorln("<r>bun upgrade failed with error: <red><b>{s}<r>\n\n<cyan>Please upgrade manually<r>:\n <b>curl -fsSL https://bun.sh/install | bash<r>\n\n", .{@errorName(err)});
Global.exit(1);
};
}
@@ -425,7 +425,7 @@ pub const UpgradeCommand = struct {
if (version.name() != null and version.isCurrent()) {
Output.prettyErrorln(
- "<r><green>Congrats!<r> You're already on the latest version of bun <d>(which is v{any})<r>",
+ "<r><green>Congrats!<r> You're already on the latest version of bun <d>(which is v{s})<r>",
.{
version.name().?,
},
@@ -441,7 +441,7 @@ pub const UpgradeCommand = struct {
Global.exit(1);
}
- Output.prettyErrorln("<r><b>bun <cyan>v{any}<r> is out<r>! You're on <blue>{any}<r>\n", .{ version.name().?, Global.package_json_version });
+ Output.prettyErrorln("<r><b>bun <cyan>v{s}<r> is out<r>! You're on <blue>{s}<r>\n", .{ version.name().?, Global.package_json_version });
Output.flush();
} else {
version = Version{
@@ -481,7 +481,7 @@ pub const UpgradeCommand = struct {
\\<r><red>error:<r> Canary builds are not available for this platform yet
\\
\\ Release: <cyan>https://github.com/oven-sh/bun/releases/tag/canary<r>
- \\ Filename: <b>{any}<r>
+ \\ Filename: <b>{s}<r>
\\
, .{
Version.zip_filename,
@@ -511,10 +511,11 @@ pub const UpgradeCommand = struct {
const version_name = version.name().?;
var save_dir_ = filesystem.tmpdir();
- var save_dir = save_dir_.makeOpenPathIterable(version_name, .{}) catch {
+ var save_dir_iterable = save_dir_.makeOpenPathIterable(version_name, .{}) catch {
Output.prettyErrorln("<r><red>error:<r> Failed to open temporary directory", .{});
Global.exit(1);
};
+ var save_dir = save_dir_iterable.dir;
var tmpdir_path = std.os.getFdPath(save_dir.fd, &tmpdir_path_buf) catch {
Output.prettyErrorln("<r><red>error:<r> Failed to read temporary directory", .{});
Global.exit(1);
@@ -529,14 +530,14 @@ pub const UpgradeCommand = struct {
if (use_profile) profile_exe_subpath else exe_subpath;
var zip_file = save_dir.createFileZ(tmpname, .{ .truncate = true }) catch |err| {
- Output.prettyErrorln("<r><red>error:<r> Failed to open temp file {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to open temp file {s}", .{@errorName(err)});
Global.exit(1);
};
{
_ = zip_file.writeAll(bytes) catch |err| {
save_dir.deleteFileZ(tmpname) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to write to temp file {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to write to temp file {s}", .{@errorName(err)});
Global.exit(1);
};
zip_file.close();
@@ -572,7 +573,7 @@ pub const UpgradeCommand = struct {
const unzip_result = unzip_process.spawnAndWait() catch |err| {
save_dir.deleteFileZ(tmpname) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to spawn unzip due to {any}.", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to spawn unzip due to {s}.", .{@errorName(err)});
Global.exit(1);
};
@@ -595,7 +596,7 @@ pub const UpgradeCommand = struct {
.max_output_bytes = 512,
}) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error<r> Failed to verify bun {any}<r>)", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error<r> Failed to verify bun {s}<r>)", .{@errorName(err)});
Global.exit(1);
};
@@ -617,7 +618,7 @@ pub const UpgradeCommand = struct {
save_dir_.deleteTree(version_name) catch {};
Output.prettyErrorln(
- "<r><red>error<r>: The downloaded version of bun (<red>{any}<r>) doesn't match the expected version (<b>{any}<r>)<r>. Cancelled upgrade",
+ "<r><red>error<r>: The downloaded version of bun (<red>{s}<r>) doesn't match the expected version (<b>{s}<r>)<r>. Cancelled upgrade",
.{
version_string[0..@min(version_string.len, 512)],
version_name,
@@ -637,24 +638,25 @@ pub const UpgradeCommand = struct {
// safe because the slash will no longer be in use
current_executable_buf[target_dir_.len] = 0;
var target_dirname = current_executable_buf[0..target_dir_.len :0];
- var target_dir = std.fs.openIterableDirAbsoluteZ(target_dirname, .{}) catch |err| {
+ var target_dir_iteratable = std.fs.openIterableDirAbsoluteZ(target_dirname, .{}) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to open bun's install directory {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to open bun's install directory {s}", .{@errorName(err)});
Global.exit(1);
};
+ var target_dir = target_dir_iteratable.dir;
if (use_canary) {
// Check if the versions are the same
const target_stat = target_dir.statFile(target_filename) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to stat target bun {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to stat target bun {s}", .{@errorName(err)});
Global.exit(1);
};
const dest_stat = save_dir.statFile(exe) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to stat source bun {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to stat source bun {s}", .{@errorName(err)});
Global.exit(1);
};
@@ -663,13 +665,13 @@ pub const UpgradeCommand = struct {
const target_hash = std.hash.Wyhash.hash(0, target_dir.readFile(target_filename, input_buf) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to read target bun {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to read target bun {s}", .{@errorName(err)});
Global.exit(1);
});
const source_hash = std.hash.Wyhash.hash(0, save_dir.readFile(exe, input_buf) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to read source bun {any}", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to read source bun {s}", .{@errorName(err)});
Global.exit(1);
});
@@ -687,7 +689,7 @@ pub const UpgradeCommand = struct {
if (env_loader.map.get("BUN_DRY_RUN") == null) {
C.moveFileZ(save_dir.fd, exe, target_dir.fd, target_filename) catch |err| {
save_dir_.deleteTree(version_name) catch {};
- Output.prettyErrorln("<r><red>error:<r> Failed to move new version of bun due to {any}. You could try the install script instead:\n curl -fsSL https://bun.sh/install | bash", .{@errorName(err)});
+ Output.prettyErrorln("<r><red>error:<r> Failed to move new version of bun due to {s}. You could try the install script instead:\n curl -fsSL https://bun.sh/install | bash", .{@errorName(err)});
Global.exit(1);
};
}
@@ -724,7 +726,7 @@ pub const UpgradeCommand = struct {
\\
\\Changelog:
\\
- \\ https://github.com/oven-sh/bun/compare/{any}...main
+ \\ https://github.com/oven-sh/bun/compare/{s}...main
\\
,
.{Environment.git_sha},
@@ -735,7 +737,7 @@ pub const UpgradeCommand = struct {
Output.prettyErrorln(
\\<r> Upgraded.
\\
- \\<b><green>Welcome to bun v{any}!<r>
+ \\<b><green>Welcome to bun v{s}!<r>
\\
\\Report any bugs:
\\
@@ -743,11 +745,11 @@ pub const UpgradeCommand = struct {
\\
\\What's new:
\\
- \\ <cyan>https://github.com/oven-sh/bun/releases/tag/{any}<r>
+ \\ <cyan>https://github.com/oven-sh/bun/releases/tag/{s}<r>
\\
\\Changelog:
\\
- \\ https://github.com/oven-sh/bun/compare/{any}...{any}
+ \\ https://github.com/oven-sh/bun/compare/{s}...{s}
\\
,
.{ version_name, version.tag, bun_v, version.tag },