Skip to content

Commit ae3ba14

Browse files
committed
Suppress repeated "Upgrading" message when target version is already installed
When the PATH-resolved plz binary is older than the version pinned in .plzconfig but the target version already exists in ~/.please/, the "Upgrading Please from X to Y" message printed on every invocation. Only print it when we actually need to download something new.
1 parent cef9536 commit ae3ba14

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/update/update.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ func CheckAndUpdate(config *core.Configuration, updatesEnabled, updateCommand, f
6363
clean(config, updateCommand)
6464
return
6565
}
66+
newPlease := filepath.Join(config.Please.Location, config.Please.Version.VersionString(), "please")
6667
word := describe(config.Please.Version.Semver(), pleaseVersion(), true)
67-
if !updateCommand {
68+
if !updateCommand && !core.PathExists(newPlease) {
6869
fmt.Fprintf(os.Stderr, "%s Please from version %s to %s\n", word, pleaseVersion(), config.Please.Version.VersionString())
6970
}
7071

@@ -84,7 +85,7 @@ func CheckAndUpdate(config *core.Configuration, updatesEnabled, updateCommand, f
8485
}
8586

8687
// Download it.
87-
newPlease := downloadAndLinkPlease(config, verify, progress)
88+
newPlease = downloadAndLinkPlease(config, verify, progress)
8889

8990
// Print update milestone message if we hit a milestone
9091
printMilestoneMessage(config.Please.Version.VersionString())

0 commit comments

Comments
 (0)