@@ -29,10 +29,10 @@ object Update extends ScalaCommand[UpdateOptions] {
29
29
// format: off
30
30
val res = os.proc(
31
31
" sh" , " -s" , " --" ,
32
+ " --version" , newVersion,
32
33
" --force" ,
33
34
" --binary-name" , options.binaryName,
34
35
" --bin-dir" , options.installDirPath,
35
- newVersion
36
36
).call(
37
37
cwd = os.pwd,
38
38
stdin = installScript.stdout,
@@ -65,14 +65,15 @@ object Update extends ScalaCommand[UpdateOptions] {
65
65
sys.error(" Can not resolve ScalaCLI version to update" )
66
66
)
67
67
68
+ val isOutdated = CommandUtils .isOutOfDateVersion(newestScalaCliVersion, currentVersion)
69
+
68
70
if (! options.isInternalRun)
69
- if (CommandUtils .isOutOfDateVersion(newestScalaCliVersion, currentVersion) )
71
+ if (isOutdated )
70
72
updateScalaCli(options, newestScalaCliVersion)
71
73
else println(" ScalaCLI is up-to-date" )
72
- else
74
+ else if (isOutdated)
73
75
println(
74
- s """ Your ScalaCLI $currentVersion is outdated, please update ScalaCLI to $newestScalaCliVersion
75
-
76
+ s """ Your ScalaCLI $currentVersion is outdated, please update ScalaCLI to $newestScalaCliVersion
76
77
|Run 'curl -sSLf https://virtuslab.github.io/scala-cli-packages/scala-setup.sh | sh' to update ScalaCLI. """ .stripMargin
77
78
)
78
79
}
@@ -109,7 +110,7 @@ object Update extends ScalaCommand[UpdateOptions] {
109
110
def run (options : UpdateOptions , args : RemainingArgs ): Unit =
110
111
checkUpdate(options)
111
112
112
- def checkUpdate (logger : Logger ): Unit = {
113
+ def checkUpdateSafe (logger : Logger ): Unit = {
113
114
Try {
114
115
val classesDir =
115
116
this .getClass.getProtectionDomain.getCodeSource.getLocation.toURI.toString
0 commit comments