Skip to content

Make version a routed command with help - #1

Merged
ach968 merged 1 commit into
ach968:mainfrom
Slava-code:fix/version-command-help
Sep 18, 2026
Merged

ach968 merged 1 commit into
ach968:mainfrom
Slava-code:fix/version-command-help

Conversation

@Slava-code

Copy link
Copy Markdown
Contributor

Summary

twt version on its own worked, but twt version --help and twt help version failed with {"code":"INVALID_ARGUMENT","message":"Unknown command: version"}. The root help lists version next to the other commands and says to run twt <command> --help, so every listed command should honor that.

Cause: version was special-cased in Application.Run before command routing, so anything other than the bare single argument fell through to the command map, where it was never registered.

Change

  • Register version as an ordinary commands.Command with its own help text, so twt version, twt version --help, twt version -h, and twt help version all work.
  • Keep twt --version as a flag with identical output.
  • twt version <extra> now fails with version does not accept arguments, matching the shape the other commands use.

Testing

  • Added version --help, version -h, and help version to the help-surface table test.
  • Added TestVersionRejectsArguments.
  • make check passes (gofmt, vet, race tests).
  • Exercised the built binary manually for all invocations above.

🤖 Generated with Claude Code

`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>
@ach968

ach968 commented Sep 18, 2026

Copy link
Copy Markdown
Owner

thx

@ach968
ach968 merged commit c54fecd into ach968:main Sep 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants