mc icon indicating copy to clipboard operation
mc copied to clipboard

--quiet leads to version check and output

Open c33s opened this issue 1 year ago • 1 comments

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

c33s avatar Nov 30 '24 22:11 c33s

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 12:04 stale[bot]