55
66. " $PSScriptRoot \..\lib\getopt.ps1"
77. " $PSScriptRoot \..\lib\manifest.ps1" # 'Get-Manifest'
8- . " $PSScriptRoot \..\lib\versions.ps1" # 'Get-InstalledVersion'
8+ . " $PSScriptRoot \..\lib\versions.ps1" # 'Get-InstalledVersion', 'Select-CurrentVersion'
99. " $PSScriptRoot \..\lib\download.ps1" # 'Get-RemoteFileSize'
1010
1111$opt , $app , $err = getopt $args ' v' ' verbose'
12+ $original_app = $app
1213if ($err ) { error " scoop info: $err " ; exit 1 }
1314$verbose = $opt.v -or $opt.verbose
1415
@@ -23,42 +24,78 @@ if (!$manifest) {
2324$global = installed $app $true
2425$status = app_status $app $global
2526$install = install_info $app $status.version $global
26- $status.installed = $bucket -and $install.bucket -eq $bucket
27+ $status.installed = ( $bucket -and $install.bucket -eq $bucket ) -or (installed $app )
2728$version_output = $manifest.version
2829$manifest_file = if ($bucket ) {
2930 manifest_path $app $bucket
3031} else {
3132 $url
3233}
3334
35+ # Standalone and Source detection
36+ if ((Test-Path $original_app ) -or ($original_app -match ' ^(ht|f)tps?://|\\\\' )) {
37+ $standalone = $true
38+ if (Test-Path $original_app ) {
39+ $original_app = (Get-AbsolutePath " $original_app " )
40+ }
41+ if ($install.url ) {
42+ if (Test-Path $install.url ) {
43+ $install_url = (Get-AbsolutePath $install.url )
44+ } else {
45+ $install_url = $install.url
46+ }
47+ }
48+ if ($original_app -eq $install_url ) {
49+ $same_source = $true
50+ }
51+ }
52+
3453if ($verbose ) {
3554 $dir = currentdir $app $global
3655 $original_dir = versiondir $app $manifest.version $global
3756 $persist_dir = persistdir $app $global
3857} else {
39- $dir , $original_dir , $persist_dir = " <root>" , " <root>" , " <root>"
58+ $dir , $original_dir , $persist_dir = ' <root>' , ' <root>' , ' <root>'
4059}
4160
4261if ($status.installed ) {
4362 $manifest_file = manifest_path $app $install.bucket
4463 if ($install.url ) {
4564 $manifest_file = $install.url
4665 }
47- if ($status.version -eq $manifest.version ) {
66+ if ($status.deprecated ) {
67+ $manifest_file = $status.deprecated
68+ } elseif ($standalone -and ! $same_source ) {
69+ $version_output = $manifest.version
70+ } elseif ($status.version -eq $manifest.version ) {
4871 $version_output = $status.version
4972 } else {
5073 $version_output = " $ ( $status.version ) (Update to $ ( $manifest.version ) available)"
5174 }
75+
5276}
5377
5478$item = [ordered ]@ { Name = $app }
79+ if ($status.deprecated ) {
80+ $item.Name += ' (DEPRECATED)'
81+ }
5582if ($manifest.description ) {
5683 $item.Description = $manifest.description
5784}
5885$item.Version = $version_output
59- if ($bucket ) {
60- $item.Bucket = $bucket
86+
87+ $item.Source = if ($standalone ) {
88+ $original_app
89+ } else {
90+ if ($install.bucket ) {
91+ $install.bucket
92+ } elseif ($install.url ) {
93+ $install.url
94+ } else {
95+ $bucket
96+ }
6197}
98+
6299if ($manifest.homepage ) {
63100 $item.Website = $manifest.homepage.TrimEnd (' /' )
64101}
@@ -70,7 +107,7 @@ if ($manifest.license) {
70107 $manifest.license
71108 } elseif ($manifest.license -match ' [|,]' ) {
72109 if ($verbose ) {
73- " $ ( $manifest.license ) ($ ( ($manifest.license -Split " \||," | ForEach-Object { " https://spdx.org/licenses/$_ .html" }) -join ' , ' ) )"
110+ " $ ( $manifest.license ) ($ ( ($manifest.license -Split ' \||,' | ForEach-Object { " https://spdx.org/licenses/$_ .html" }) -join ' , ' ) )"
74111 } else {
75112 $manifest.license
76113 }
@@ -101,11 +138,13 @@ if ($verbose) { $item.Manifest = $manifest_file }
101138
102139if ($status.installed ) {
103140 # Show installed versions
104- $installed_output = @ ()
105- Get-InstalledVersion - AppName $app - Global:$global | ForEach-Object {
106- $installed_output += if ($verbose ) { versiondir $app $_ $global } else { " $_ $ ( if ($global ) { " *global*" }) " }
141+ if (! $standalone -or $same_source ) {
142+ $installed_output = @ ()
143+ Get-InstalledVersion - AppName $app - Global:$global | ForEach-Object {
144+ $installed_output += if ($verbose ) { versiondir $app $_ $global } else { " $_ $ ( if ($global ) { ' *global*' }) " }
145+ }
146+ $item.Installed = $installed_output -join " `n "
107147 }
108- $item.Installed = $installed_output -join " `n "
109148
110149 if ($verbose ) {
111150 # Show size of installation
@@ -162,7 +201,7 @@ if ($status.installed) {
162201 foreach ($url in @ (url $manifest (Get-DefaultArchitecture ))) {
163202 try {
164203 if (Test-Path (cache_path $app $manifest.version $url )) {
165- $cached = " (latest version is cached)"
204+ $cached = ' (latest version is cached)'
166205 } else {
167206 $cached = $null
168207 }
@@ -197,15 +236,15 @@ if ($binaries) {
197236 $binary_output += $_
198237 }
199238 }
200- $item.Binaries = $binary_output -join " | "
239+ $item.Binaries = $binary_output -join ' | '
201240}
202241$shortcuts = @ (arch_specific ' shortcuts' $manifest $install.architecture )
203242if ($shortcuts ) {
204243 $shortcut_output = @ ()
205244 $shortcuts | ForEach-Object {
206245 $shortcut_output += $_ [1 ]
207246 }
208- $item.Shortcuts = $shortcut_output -join " | "
247+ $item.Shortcuts = $shortcut_output -join ' | '
209248}
210249$env_set = arch_specific ' env_set' $manifest $install.architecture
211250if ($env_set ) {
0 commit comments