Skip to content

Commit 6bd7812

Browse files
committed
feat(scoop-home): Adopt Resolve-ManifestInformation
- #140
1 parent 9d9076e commit 6bd7812

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- **scoop-cat**: Add `-f`, `--format` options
66
- Adopt new resolve function for parameter passing
7+
- **scoop-home**
78
- **scoop-cat**
89
- **scoop-download**
910

libexec/scoop-home.ps1

+22-8
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,32 @@ $Options, $Application, $_err = getopt $args
1616
if ($_err) { Stop-ScoopExecution -Message "scoop home: $_err" -ExitCode 2 }
1717
if (!$Application) { Stop-ScoopExecution -Message 'Parameter <APP> missing' -Usage (my_usage) }
1818

19-
# TODO: Adopt Resolve-ManifestInformation
20-
$manifest, $null = find_manifest $Application
21-
if ($manifest) {
22-
if ([String]::IsNullOrEmpty($manifest.homepage)) {
19+
$Application = $Application[0]
20+
# Home does not need to generate the manifest as homepage will not change
21+
if ($Application -notmatch '^https?://') { $Application = ($Application -split '@')[0] }
22+
23+
$resolved = $null
24+
try {
25+
$resolved = Resolve-ManifestInformation -ApplicationQuery $Application
26+
} catch {
27+
$title, $body = $_.Exception.Message -split '\|-'
28+
if (!$body) { $body = $title }
29+
Write-UserMessage -Message $body -Err
30+
debug $_.InvocationInfo
31+
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $appName -Bucket $bucket -Title $title -Body $body }
32+
33+
$ExitCode = 3
34+
}
35+
36+
debug $resolved
37+
38+
if ($ExitCode -ne 3) {
39+
if ([String]::IsNullOrEmpty($resolved.ManifestObject.homepage)) {
2340
Write-UserMessage -Message 'Manifest does not contain homepage property' -Err
2441
$ExitCode = 3
2542
} else {
26-
Start-Process $manifest.homepage
43+
Start-Process $resolved.ManifestObject.homepage
2744
}
28-
} else {
29-
Write-UserMessage -Message "Could not find manifest for '$Application'" -Err
30-
$ExitCode = 3
3145
}
3246

3347
exit $ExitCode

0 commit comments

Comments
 (0)