Fix rodney start --show flag parsing bug#24
Open
jacobb wants to merge 2 commits into
Open
Conversation
The --show flag was documented in help.txt but rejected at runtime. Two sequential arg-parsing loops meant the first loop called fatal() on --show before the second loop (which handled it) could run. Extract parseStartFlags() with a single merged loop and add 6 tests. Fixes simonw#23 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I frequently stumble on this bug when trying Rodney @simonw anything you need to get this merged? |
|
@simonw I'd like to second this, I just ran into this problem myself while trying to test rodney out. I can help out if there's anything else that needs to be done. |
|
Sadly @simonw is quite busy these days so it can take quite some time till he has time to come back to his creations. :/ |
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
rodney start --showfailed withunknown flag: --showbecause the argument parser had two sequential loops — the first rejected--showbefore the second (which handled it) could runparseStartFlags()with a single merged switch statement--show,--show --insecure,--insecure,-k, no args, and unknown flagsFixes #23
Demo
The
--showflag forrodney startwas documented in help.txt but broken — the argument parser rejected it as an unknown flag before reaching the code that handled it. Two sequential loops: the first validated flags (only knew--insecure/-k) and calledfatal()on anything else; the second setheadless=falsefor--showbut was dead code.The fix extracts flag parsing into a testable
parseStartFlagsfunction and merges both loops into a single switch statement. Six new tests cover--showalone,--show --insecuretogether,--insecureonly,-kshorthand, no args, and unknown flags.go test -run TestParseStartFlags -vAll 6 new tests pass. The full suite (65 tests) also passes with no regressions.
Test plan
TestParseStartFlags_ShowFlag—--showalone sets headless=falseTestParseStartFlags_ShowAndInsecure— both flags work togetherTestParseStartFlags_InsecureOnly—--insecureregression testTestParseStartFlags_KShorthand—-kregression testTestParseStartFlags_NoArgs— defaults are correctTestParseStartFlags_UnknownFlag— unknown flags still rejected🤖 Generated with Claude Code