Repository navigation
Make version a routed command with help - #1
Merged
Merged
Conversation
`twt version` was special-cased in Run before command routing, so `twt version --help` and `twt help version` fell through to the command map and failed with "Unknown command: version" even though the root help lists version alongside the other commands and directs users to `twt <command> --help`. Register version as an ordinary command with its own help text, keep `--version` as a flag, and reject extra arguments with the same INVALID_ARGUMENT shape the other commands use. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner
|
thx |
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
twt versionon its own worked, buttwt version --helpandtwt help versionfailed with{"code":"INVALID_ARGUMENT","message":"Unknown command: version"}. The root help listsversionnext to the other commands and says to runtwt <command> --help, so every listed command should honor that.Cause:
versionwas special-cased inApplication.Runbefore command routing, so anything other than the bare single argument fell through to the command map, where it was never registered.Change
versionas an ordinarycommands.Commandwith its own help text, sotwt version,twt version --help,twt version -h, andtwt help versionall work.twt --versionas a flag with identical output.twt version <extra>now fails withversion does not accept arguments, matching the shape the other commands use.Testing
version --help,version -h, andhelp versionto the help-surface table test.TestVersionRejectsArguments.make checkpasses (gofmt, vet, race tests).🤖 Generated with Claude Code