fix(io): print only help/data to stdout#4
Merged
btschwartz12 merged 1 commit intomainfrom Oct 17, 2025
Merged
Conversation
btschwartz12
commented
Oct 16, 2025
Comment on lines
64
to
+69
| func (c *Command) HelpFunc(cmd *cobra.Command, _ []string) { | ||
| formatter.Println(rootHelpFunc(cmd)) | ||
| formatter.Println(formatter.Stdout, rootHelpFunc(cmd)) | ||
| } | ||
|
|
||
| func (c *Command) UsageFunc(cmd *cobra.Command, _ []string) { | ||
| formatter.Println(rootHelpFunc(cmd)) | ||
| formatter.Println(formatter.Stderr, rootHelpFunc(cmd)) |
Contributor
Author
There was a problem hiding this comment.
By convention, Cobra will print help output to stdout (since the user explicitly requested it with the --help flag) and will print usage output (which only occurs during an error) to stderr.
We are overriding Cobra's built-in help/usage functions, so we should follow the same pattern.
67816a4 to
a74e7f1
Compare
a74e7f1 to
c8f89e2
Compare
📚 Documentation ReminderThis PR modifies command implementation files but doesn't update the corresponding documentation:
Action Required:
This is an automated check to help keep our documentation in sync with code changes. |
oscarv-censys
approved these changes
Oct 17, 2025
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.
Currently, some errors/warnings are printed to stdout. This PR ensures anything that isn't data explicitly requested by the user (i.e. response data, command help) is printed to stderr.