-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: short params parsing within zig-clap fork #14845
Open
renanmav
wants to merge
16
commits into
oven-sh:main
Choose a base branch
from
renanmav:renan/fix-short-params
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+76
β10
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
408ecbb
fix: short params parsing within zig-clap fork
renanmav 26c228d
refactor: maintain compatibility and proper error handling
renanmav c16b7da
test: push 7114 regression test
renanmav 18e7b76
chore: fix typo chainging -> chaining
renanmav 65e2e07
chore: remove unused parseShortFlag fn
renanmav f352367
test: pass stderr to lower case
renanmav e5ed6c7
test: amend test with flags that requires a value but none was supplied
renanmav a4e416c
chore: sync zig-clap fork with upstream
renanmav 4f5fb6d
feat: enable warn_on_unrecognized_flag
renanmav 78bb5f3
feat: continue parsing after unrecognized short flag
renanmav 2dd69e8
Merge branch 'main' into renan/fix-short-params
renanmav 519684c
Merge branch 'main' into renan/fix-short-params
renanmav 77be373
Merge branch 'main' into renan/fix-short-params
renanmav b0683a3
Merge branch 'main' into renan/fix-short-params
renanmav ff5c489
Merge branch 'main' into renan/fix-short-params
renanmav f7187fa
Merge branch 'main' into renan/fix-short-params
renanmav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { expect, test } from "bun:test"; | ||
import { bunEnv, bunExe, tempDirWithFiles } from "harness"; | ||
|
||
test("short flags should be properly parsed", () => { | ||
const dir = tempDirWithFiles("07114", { | ||
"package.json": JSON.stringify({ | ||
name: "short-flags-test", | ||
version: "0.0.0", | ||
}), | ||
}); | ||
|
||
// Test single short flag | ||
const singleFlag = Bun.spawnSync({ | ||
cmd: [bunExe(), "-t"], // as in `bun create expo ./awesome-project -t tabs` | ||
cwd: dir, | ||
env: bunEnv, | ||
stderr: "pipe", | ||
}); | ||
expect(singleFlag.stderr.toString().toLowerCase()).not.toContain("invalid argument '-t'"); | ||
|
||
// Test multiple combined short flags | ||
const multipleFlags = Bun.spawnSync({ | ||
cmd: [bunExe(), "-ab"], | ||
cwd: dir, | ||
env: bunEnv, | ||
stderr: "pipe", | ||
}); | ||
expect(multipleFlags.stderr.toString().toLowerCase()).not.toContain("invalid argument"); | ||
expect(multipleFlags.stderr.toString().toLowerCase()).not.toContain("requires a value but none was supplied"); | ||
|
||
// Test short flag with value | ||
const flagWithValue = Bun.spawnSync({ | ||
cmd: [bunExe(), "-p", "3000"], | ||
cwd: dir, | ||
env: bunEnv, | ||
stderr: "pipe", | ||
}); | ||
expect(flagWithValue.stderr.toString().toLowerCase()).not.toContain("invalid argument '-p'"); | ||
|
||
// Test short flag that requires a value but none was supplied | ||
const flagWithoutValue = Bun.spawnSync({ | ||
cmd: [bunExe(), "-p"], | ||
cwd: dir, | ||
env: bunEnv, | ||
stderr: "pipe", | ||
}); | ||
expect(flagWithoutValue.stderr.toString().toLowerCase()).toContain("requires a value but none was supplied"); | ||
}); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change of this PR