Skip to content
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

Add verbose flag for the run command #3193

Merged
merged 1 commit into from
May 3, 2022
Merged

Conversation

johnpoth
Copy link
Member

Thanks !

Release Note

NONE

Copy link
Contributor

@squakez squakez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to get rid off the fmt.Print default favouring fmt.Fprintln(cmd.OutOrStdout(), ...). Even more, as it's a warning, I think we better use stderr via cmd.ErrOrStderr().

Additionally I'd wrap a function, ie, printOut(verbose bool) where you have the if condition, and call directly this function within the rest of the code. We will have a more readable code.

pkg/cmd/run.go Outdated Show resolved Hide resolved
pkg/cmd/run.go Outdated Show resolved Hide resolved
pkg/cmd/run.go Outdated Show resolved Hide resolved
pkg/cmd/run.go Outdated Show resolved Hide resolved
pkg/cmd/run.go Outdated Show resolved Hide resolved
@tadayosi
Copy link
Member

Additionally I'd wrap a function, ie, printOut(verbose bool) where you have the if condition, and call directly this function within the rest of the code. We will have a more readable code.

That sounds a nice idea. I'd push it further and make wrapped printing functions as methods for rootCmdOptions so that all child commands can exploit them. Maybe we could have o.printOut(), o.printErr(), o.printVerboseOut(), and o.printVerboseErr().

@johnpoth
Copy link
Member Author

maybe worth switching to using klog like we do in the operator

@squakez
Copy link
Contributor

squakez commented Apr 29, 2022

maybe worth switching to using klog like we do in the operator

Sure. Alternatively we can finalize this and make a follow up issue to do it.

@johnpoth johnpoth force-pushed the run-verbose branch 3 times, most recently from 030cd94 to c37d1f3 Compare May 2, 2022 08:44
@johnpoth
Copy link
Member Author

johnpoth commented May 2, 2022

Sounds good ! Applied the changes, thanks !

pkg/cmd/run.go Show resolved Hide resolved
@johnpoth johnpoth merged commit 9210eb8 into apache:main May 3, 2022
@johnpoth johnpoth deleted the run-verbose branch May 3, 2022 08:14
@johnpoth
Copy link
Member Author

johnpoth commented May 3, 2022

Thanks @squakez @tadayosi for the review! merging ...

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.

None yet

3 participants