mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
oops
This commit is contained in:
@@ -350,14 +350,16 @@ pub const UpgradeCommand = struct {
|
||||
if (args.len > 2) {
|
||||
var upgrade_index: ?usize = null;
|
||||
for (args[1..], 1..) |arg, i| {
|
||||
if (upgrade_index == null and strings.eqlComptime(arg, "upgrade")) {
|
||||
upgrade_index = i + 1;
|
||||
continue;
|
||||
if (upgrade_index) |_| {
|
||||
if (strings.eqlComptime(arg, "upgrade")) {
|
||||
upgrade_index = i + 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// if this is before the "upgrade", just judge that it's a flag (because BUN_OPTIONS are passed here)
|
||||
// otherwise, needs to be one of the specific flags
|
||||
if (upgrade_index == null) {
|
||||
if (upgrade_index) |_| {
|
||||
if (strings.startsWith(arg, "--")) continue;
|
||||
} else {
|
||||
if (strings.eqlComptime(arg, "--canary") or
|
||||
|
||||
@@ -43,7 +43,7 @@ const invalid_tests = [
|
||||
[["upgrade", "--latest"], "bun update --latest"],
|
||||
];
|
||||
for (const [args, expected] of invalid_tests) {
|
||||
it("two invalid arguments, should display error message and suggest command", async () => {
|
||||
it(`"${args.join(" ")}": should display error message and suggest command`, async () => {
|
||||
const { stderr } = spawn({
|
||||
cmd: [execPath, ...args],
|
||||
cwd,
|
||||
|
||||
Reference in New Issue
Block a user