Repository navigation
fix(cli): refuse a flag where an option's value should be - #707
Merged
Merged
Conversation
PowerShell 5.1 drops an empty argument, so `nexus workspace edit X --name '' --json` reached the CLI as `--name --json` and named the workspace "--json". The shared parser now treats a following `--...` token as a missing value, with the same "needs a value (an empty one: --name=, ...)" error it gives at the end of the line. A value that starts with `--` is still given as `--name=--value`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Windows QA for 0.35.0 found this. PowerShell 5.1 drops an empty argument, so
nexus workspace edit X --name '' --jsonreached the CLI as--name --json, and the workspace was renamed to--json.parseArgs(shared by every command) already refuses a value option at the end of the line with--name needs a value (an empty one: --name=, which every shell passes). It now gives that same error when the next token starts with--. This covers every string and number option, such as--name,--colorand--workspace.--can still be given as--name=--value. The parser's header comment now says so.--(end of flags) are unchanged.Test plan
tests/unit/main/cli/args.test.ts:--workspace --json.bun test tests/unit/main/cli: 339 pass, 4 skip, 0 fail.biome checkon the two files.🤖 Generated with Claude Code