Closed bionicles closed 4 months ago
Here's a workaround:
function Get-ScoopVersion {
Log "Getting Scoop Version"
# Define the path to Scoop's CHANGELOG.md
$changelogPath = "C:\Users\$env:USERNAME\scoop\apps\scoop\current\CHANGELOG.md"
# Read the version from CHANGELOG.md
if (Test-Path -Path $changelogPath) {
$pattern = '^## \[(?<version>v[\d.]+)\]'
$content = Get-Content $changelogPath -Raw
$match = [Regex]::Match($content, $pattern)
if ($match.Success) {
$version = $match.Groups["version"].Value
Log "Scoop version: $version"
return $version
} else {
Log "Scoop version not found in CHANGELOG"
}
} else {
Log "CHANGELOG.md not found at $changelogPath"
}
return "Unknown"
}
[2024-01-06T15:24:44.2140546-05:00] Getting Scoop Version
[2024-01-06T15:24:44.2180717-05:00] Scoop version: v0.3.1
PowerShell has a different concept of streams. It has multiple output streams, see https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_output_streams?view=powershell-7.4.
The Scoop version output in scoop -v
command gets written to the Information stream. To capture it, you can do:
Bug Report
Current Behavior
Expected Behavior
Additional context/output
I'm a scoop noob and dislike powershell so I probably don't know what I'm doing. However, one would imagine printing the version number to stdout would "just work"
Possible Solution
Scoop probably outputs the version info in a weird way, and just doing it the same way as the "b8858b841 twitchdownloader: Update to version 1.53.9 e0d4894cc ugrep: Update to version 4.5.1" would work
Or, it's outputting too much info and we just need a version number but we're getting a ton of output and it confuses PowerShell.
System details
Windows version: 11
OS architecture: 64bit
PowerShell version: [output of
"$($PSVersionTable.PSVersion)"
]Additional software: [(optional) e.g. ConEmu, Git] $($PSVersionTable.PSVersion)
Major Minor Patch PreReleaseLabel BuildLabel
7 3 10
Scoop Configuration