-
Notifications
You must be signed in to change notification settings - Fork 170
fix: Add default values to CLI flag help text #3166
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: Add default values to CLI flag help text #3166
Conversation
Add default values to flag descriptions for improved user experience. This provides better visibility into default behavior when viewing help text for various CLI commands including run, list, stop, and rm. The pattern "(default: X)" is added consistently to flag descriptions where meaningful defaults exist. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> Signed-off-by: majiayu000 <[email protected]>
eleftherias
left a comment
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.
Thanks for the PR @majiayu000. As I was reviewing it I noticed many of these changes are not needed because Cobra will automatically add the default value to the description.
Instead of adding (default: X) everywhere, could you run thv run --help, thv list ---help etc, and verify that the default value is not already listed?
Note that I've called out some cases where the change is not needed in the comments below, but I have not listed every single one.
| "Skip opening browser for remote server OAuth flow") | ||
| "Skip opening browser for remote server OAuth flow (default: false)") | ||
| cmd.Flags().DurationVar(&config.RemoteAuthTimeout, "remote-auth-timeout", 30*time.Second, | ||
| "Timeout for OAuth authentication flow (e.g., 30s, 1m, 2m30s)") |
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 change is not needed. If you run thv run --help you will see that Cobra shows the default value in the description. Cobra will do this when the default value is something other than false.
cmd/thv/app/auth_flags.go
Outdated
| "Timeout for OAuth authentication flow (e.g., 30s, 1m, 2m30s) (default: 30s)") | ||
| cmd.Flags().IntVar(&config.RemoteAuthCallbackPort, "remote-auth-callback-port", runner.DefaultCallbackPort, | ||
| "Port for OAuth callback server during remote authentication") | ||
| "Port for OAuth callback server during remote authentication (default: 8666)") |
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 change is not needed. If you run thv run --help you will see that Cobra shows the default value in the description.
cmd/thv/app/list.go
Outdated
| listCmd.Flags().BoolVarP(&listAll, "all", "a", false, "Show all workloads (default shows just running)") | ||
| listCmd.Flags().StringVar(&listFormat, "format", FormatText, "Output format (json, text, or mcpservers)") | ||
| listCmd.Flags().BoolVarP(&listAll, "all", "a", false, "Show all workloads (default shows just running) (default: false)") | ||
| listCmd.Flags().StringVar(&listFormat, "format", FormatText, "Output format (json, text, or mcpservers) (default: text)") |
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 change is not needed. If you run thv list --help you will see that Cobra shows the default value in the description.
cmd/thv/app/run_flags.go
Outdated
| "proxy-mode", | ||
| "streamable-http", | ||
| "Proxy mode for stdio (streamable-http or sse (deprecated, will be removed))") | ||
| "Proxy mode for stdio (streamable-http or sse (deprecated, will be removed)) (default: streamable-http)") |
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 change is not needed. If you run thv run --help you will see that Cobra shows the default value in the description.
|
@majiayu000 Let us know if you plan on addressing some of the feedback raised above. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3166 +/- ##
==========================================
+ Coverage 63.64% 63.67% +0.03%
==========================================
Files 361 361
Lines 35449 35449
==========================================
+ Hits 22560 22571 +11
+ Misses 11082 11063 -19
- Partials 1807 1815 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for the feedback @eleftherias. I've synced with main and removed the redundant default values from the flag descriptions, as Cobra adds them automatically. I also resolved the merge conflicts with the recent upstream changes. Ready for review! |
Thanks for the reminder. I was too busy this time. Feel free to close this pr if also questionable. |
e9d28e6 to
99ffab0
Compare
Looking at the updates it seems like no new defaults were added and that one of the defaults was removed. I'll go ahead and close this PR since it's removing some of the functionality we want. |
Summary
This PR fixes #3049
Changes
cmd/thv/app/auth_flags.gocmd/thv/app/list.gocmd/thv/app/rm.gocmd/thv/app/run_flags.gocmd/thv/app/stop.go