mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
Support bunx --version (#10701)
This commit is contained in:
27
src/cli.zig
27
src/cli.zig
@@ -208,9 +208,8 @@ pub const Arguments = struct {
|
||||
pub const run_params = run_only_params ++ runtime_params_ ++ transpiler_params_ ++ base_params_;
|
||||
|
||||
const bunx_commands = [_]ParamType{
|
||||
clap.parseParam("--silent Don't print the script command") catch unreachable,
|
||||
clap.parseParam("-b, --bun Force a script or package to use Bun's runtime instead of Node.js (via symlinking node)") catch unreachable,
|
||||
};
|
||||
} ++ auto_only_params;
|
||||
|
||||
const build_only_params = [_]ParamType{
|
||||
clap.parseParam("--compile Generate a standalone Bun executable containing your bundled code") catch unreachable,
|
||||
@@ -251,18 +250,6 @@ pub const Arguments = struct {
|
||||
};
|
||||
pub const test_params = test_only_params ++ runtime_params_ ++ transpiler_params_ ++ base_params_;
|
||||
|
||||
fn printVersionAndExit() noreturn {
|
||||
@setCold(true);
|
||||
Output.writer().writeAll(Global.package_json_version ++ "\n") catch {};
|
||||
Global.exit(0);
|
||||
}
|
||||
|
||||
fn printRevisionAndExit() noreturn {
|
||||
@setCold(true);
|
||||
Output.writer().writeAll(Global.package_json_version_with_revision ++ "\n") catch {};
|
||||
Global.exit(0);
|
||||
}
|
||||
|
||||
pub fn loadConfigPath(allocator: std.mem.Allocator, auto_loaded: bool, config_path: [:0]const u8, ctx: Command.Context, comptime cmd: Command.Tag) !void {
|
||||
var config_file = switch (bun.sys.openA(config_path, std.os.O.RDONLY, 0)) {
|
||||
.result => |fd| fd.asFile(),
|
||||
@@ -2341,3 +2328,15 @@ pub const Command = struct {
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
pub fn printVersionAndExit() noreturn {
|
||||
@setCold(true);
|
||||
Output.writer().writeAll(Global.package_json_version ++ "\n") catch {};
|
||||
Global.exit(0);
|
||||
}
|
||||
|
||||
pub fn printRevisionAndExit() noreturn {
|
||||
@setCold(true);
|
||||
Output.writer().writeAll(Global.package_json_version_with_revision ++ "\n") catch {};
|
||||
Global.exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user