diff options
author | 2023-09-04 18:39:19 -0700 | |
---|---|---|
committer | 2023-09-04 18:39:19 -0700 | |
commit | 5e908c3108873602f5975d959ae0cc26518bc3df (patch) | |
tree | e4c236aba9beb11000ef01988806245c395bfad4 | |
parent | 5f34c44ec6af175889e26aa5f42c817dd3de61c4 (diff) | |
download | bun-5e908c3108873602f5975d959ae0cc26518bc3df.tar.gz bun-5e908c3108873602f5975d959ae0cc26518bc3df.tar.zst bun-5e908c3108873602f5975d959ae0cc26518bc3df.zip |
Add zig changes
Diffstat (limited to '')
-rw-r--r-- | src/cli.zig | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cli.zig b/src/cli.zig index c68297baa..afc489ea0 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -834,6 +834,15 @@ const AutoCommand = struct { try HelpCommand.execWithReason(allocator, .invalid_command); } }; +pub const ReservedCommand = struct { + pub fn exec() !void { + @setCold(true); + Output.prettyError("<r><red>Uh-oh<r>. That command is reserved for future use.\n", .{}); + Output.flush(); + std.process.exit(1); + } +}; + const InitCommand = @import("./cli/init_command.zig").InitCommand; pub const HelpCommand = struct { @@ -1127,6 +1136,23 @@ pub const Command = struct { } else .DevCommand, RootCommandMatcher.case("help") => .HelpCommand, + + RootCommandMatcher.case("deploy") => .ReservedCommand, + RootCommandMatcher.case("cloud") => .ReservedCommand, + RootCommandMatcher.case("info") => .ReservedCommand, + RootCommandMatcher.case("config") => .ReservedCommand, + RootCommandMatcher.case("use") => .ReservedCommand, + RootCommandMatcher.case("auth") => .ReservedCommand, + RootCommandMatcher.case("login") => .ReservedCommand, + RootCommandMatcher.case("logout") => .ReservedCommand, + RootCommandMatcher.case("whoami") => .ReservedCommand, + RootCommandMatcher.case("publish") => .ReservedCommand, + RootCommandMatcher.case("prune") => .ReservedCommand, + RootCommandMatcher.case("outdated") => .ReservedCommand, + RootCommandMatcher.case("list") => .ReservedCommand, + RootCommandMatcher.case("why") => .ReservedCommand, + // RootCommandMatcher.case("ci") => .ReservedCommand, + else => .AutoCommand, }; } @@ -1226,6 +1252,7 @@ pub const Command = struct { .DiscordCommand => return try DiscordCommand.exec(allocator), .HelpCommand => return try HelpCommand.exec(allocator), .InitCommand => return try InitCommand.exec(allocator, bun.argv()), + .ReservedCommand => return try ReservedCommand.exec(), else => {}, } @@ -1648,6 +1675,8 @@ pub const Command = struct { UpdateCommand, UpgradeCommand, + ReservedCommand, + pub fn params(comptime cmd: Tag) []const Arguments.ParamType { return &comptime switch (cmd) { Command.Tag.BuildCommand => Arguments.build_params, |