fix(cli): parse inline values for optional short flags - #31077
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe PR fixes short option argument parsing to handle optional values with ChangesShort option parsing with optional values
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds the `bun run <flag> app.ts` and `bun <flag> run app.ts` argv shapes from #31077 to the config-flag matrix, on top of the `bun <flag> app.ts` shape that was already covered. Co-authored-by: jinhyuk9714 <jinhyuk9714@gmail.com>
|
Thanks for tracking this down, and sorry for the slow response here. This overlaps with #34983, which fixes the same The argv shapes from your test ( |
What does this PR do?
Fixes #21431.
Short optional CLI flags such as
-c=custom.tomlwere parsed as bare flags before the short-option parser checked the inline=value. This makes theValues::OneOptionalshort-flag path return the value after=while preserving the existingDoesntTakeValueerror for no-value flags like-a=value.The regression test covers the reported config forms:
bun -c=custom.toml index.tsbun -c=custom.toml run index.tsbun run -c=custom.toml index.tsHow did you verify your code works?
USE_SYSTEM_BUN=1 bun test test/cli/bun.test.ts -t "-c=path loads bunfig"(fails on system Bun 1.3.14 withmissing, confirming the regression)git diff --checkPATH="$HOME/.cargo/bin:$PATH" SDKROOT="$(xcrun --show-sdk-path)" DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer RUSTFLAGS="-C link-arg=-isysroot -C link-arg=$(xcrun --show-sdk-path)" cargo test -p bun_clap short_paramsbuild/debug/bun-debug test test/cli/bun.test.ts -t "-c=path loads bunfig"Local caveat: my Homebrew LLVM 21 config points at a missing CommandLineTools
MacOSX26.sdk, so the fullbun bd test ...command needed local generated-build env fixes to use the installed Xcode SDK/Apple clang for host/Rust build edges. No generated files are included in this PR.Note: I used Codex to help inspect the issue/code path and draft the tests, then reviewed the final diff and ran the listed verification commands locally.