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

feat: add --quiet flag to suppress verbose logs in #2998

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

olamilekan000
Copy link

Change introduces a `--quiet` flag to minimize log output during the `copyAction` function.

Link to issue - #2963 (comment)

@olamilekan000 olamilekan000 force-pushed the add-quiet-flag-to-command branch from 2721762 to 04b3bdc Compare December 10, 2024 00:10
AkihiroSuda
AkihiroSuda previously approved these changes Dec 10, 2024
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda added this to the v1.0.3 milestone Dec 10, 2024
@AkihiroSuda AkihiroSuda added the area/cli limactl CLI user experience label Dec 10, 2024
@olamilekan000
Copy link
Author

Thanks

You're welcome!

@@ -33,6 +33,7 @@ func newCopyCommand() *cobra.Command {
}

copyCommand.Flags().BoolP("recursive", "r", false, "copy directories recursively")
copyCommand.Flags().BoolP("quiet", "q", false, "suppress output logs")
Copy link
Member

Choose a reason for hiding this comment

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

I would consider making this quiet by default and adding -v --verbose for the verbose output, like the underling command we run and most commands.

Copy link
Member

Choose a reason for hiding this comment

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

SGTM

Copy link
Author

Choose a reason for hiding this comment

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

@AkihiroSuda should the PR be updated to go with this flow?

Copy link
Member

Choose a reason for hiding this comment

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

I believe that's what he meant by "sounds good to me" (SGTM).

Comment on lines 131 to 137
if quiet {
sshCmd.Stdout = nil
sshCmd.Stderr = nil
} else {
sshCmd.Stdout = cmd.OutOrStdout()
sshCmd.Stderr = cmd.ErrOrStderr()
}
Copy link
Member

Choose a reason for hiding this comment

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

Can be simplified:

Suggested change
if quiet {
sshCmd.Stdout = nil
sshCmd.Stderr = nil
} else {
sshCmd.Stdout = cmd.OutOrStdout()
sshCmd.Stderr = cmd.ErrOrStderr()
}
if !quiet {
sshCmd.Stdout = cmd.OutOrStdout()
sshCmd.Stderr = cmd.ErrOrStderr()
}

The fields are nil by default.

@olamilekan000 olamilekan000 force-pushed the add-quiet-flag-to-command branch from c97e496 to 036c68a Compare December 10, 2024 21:35
debug, err := cmd.Flags().GetBool("debug")
if err != nil {
return err
}
if debug {

if debug && !quiet {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the --quiet option should override --debug. It should only apply to the output of the ssh command itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli limactl CLI user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants