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

--quiet leads to version check and output #5089

Open
c33s opened this issue Nov 30, 2024 · 0 comments
Open

--quiet leads to version check and output #5089

c33s opened this issue Nov 30, 2024 · 0 comments

Comments

@c33s
Copy link

c33s commented Nov 30, 2024

the code of your quiet part looks wrong to me. according your doc block it says don't print update message if quiet flag is true but the if code looks inverted (wrong) to me. i noticed an update check after setting the quiet env var.

noticed in version on alpine 3.20:

mcli version RELEASE.2024-05-24T09-08-49Z (commit-id=0000000000000000000000000000000000000000)
Runtime: go1.22.5 linux/amd64
Copyright (c) 2015-2024 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

and checked the code on the latest release at the current date:
https://github.com/minio/mc/blob/RELEASE.2024-11-17T19-35-25Z/cmd/main.go#L398

// Check for updates and print a notification message
func checkUpdate(ctx *cli.Context) {
	// Do not print update messages, if quiet flag is set.
	if ctx.Bool("quiet") || ctx.GlobalBool("quiet") {
		// Its OK to ignore any errors during doUpdate() here.
		if updateMsg, _, currentReleaseTime, latestReleaseTime, _, err := getUpdateInfo("", 2*time.Second); err == nil {
			printMsg(updateMessage{
				Status:  "success",
				Message: updateMsg,
			})
		} else {
			printMsg(updateMessage{
				Status:  "success",
				Message: prepareUpdateMessage("Run `mc update`", latestReleaseTime.Sub(currentReleaseTime)),
			})
		}
	}
}

mc --version

  • RELEASE.2024-11-17T19-35-25Z

System information

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant