Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libexec/scoop-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if ($apps.length -eq 1) {
}
$curVersion = Select-CurrentVersion -AppName $app -Global:$global
if ($null -eq $version -and $curVersion) {
warn "'$app' ($curVersion) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version."
warn "'$app' ($curVersion) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version.`n`tscoop update $app$(if ($global) { ' --global' })"
exit 0
}
}
Expand All @@ -101,7 +101,7 @@ if ($specific_versions.Count -gt 0) {
$specific_versions_paths = $specific_versions | ForEach-Object {
$app, $bucket, $version = parse_app $_
if (installed_manifest $app $version) {
warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version."
warn "'$app' ($curVersion) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version.`n`tscoop update $app$(if ($global) { ' --global' })"
continue
Comment on lines 103 to 105
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use $version in the specific-version warning.

$curVersion comes from the earlier single-app precheck, so in this loop it can be empty or stale. That makes the scoop install app@version warning print () or the wrong version. Use the parsed $version here instead.

🐛 Proposed fix
-        warn "'$app' ($curVersion) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version.`n`tscoop update $app$(if ($global) { ' --global' })"
+        warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version.`n`tscoop update $app$(if ($global) { ' --global' })"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (installed_manifest $app $version) {
warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version."
warn "'$app' ($curVersion) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version.`n`tscoop update $app$(if ($global) { ' --global' })"
continue
if (installed_manifest $app $version) {
warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version.`n`tscoop update $app$(if ($global) { ' --global' })"
continue
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libexec/scoop-install.ps1` around lines 103 - 105, The warning uses the stale
variable $curVersion inside the loop; update the warn call in the
installed_manifest check to use the parsed $version variable instead of
$curVersion (replace both occurrences of $curVersion in the message with
$version) so the "scoop install app@version" specific-version warning shows the
correct version; locate this in the installed_manifest $app $version conditional
and modify the warn invocation accordingly.

}

Expand Down