mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-05-14 05:32:54 +00:00
51 lines
1.1 KiB
PowerShell
51 lines
1.1 KiB
PowerShell
param($app, $dir)
|
|
|
|
. "$psscriptroot\..\lib\core.ps1"
|
|
. "$psscriptroot\..\lib\manifest.ps1"
|
|
. "$psscriptroot\..\lib\description.ps1"
|
|
|
|
if(!$dir) {
|
|
$dir = "$psscriptroot\..\bucket"
|
|
}
|
|
$dir = resolve-path $dir
|
|
|
|
$search = "*"
|
|
if($app) { $search = $app }
|
|
|
|
# get apps to check
|
|
$apps = @()
|
|
gci $dir "$search.json" | % {
|
|
$json = parse_json "$dir\$_"
|
|
$apps += ,@(($_ -replace '\.json$', ''), $json)
|
|
}
|
|
|
|
$apps |% {
|
|
$app, $json = $_
|
|
write-host "$app`: " -nonewline
|
|
|
|
if(!$json.homepage) {
|
|
write-host "`nNo homepage set." -fore red
|
|
return
|
|
}
|
|
# get description from homepage
|
|
try {
|
|
$home_html = (new-object net.webclient).downloadstring($json.homepage)
|
|
} catch {
|
|
write-host "`n$($_.exception.message)" -fore red
|
|
return
|
|
}
|
|
|
|
$description, $descr_method = find_description $json.homepage $home_html
|
|
if(!$description) {
|
|
write-host -fore red "`nDescription not found ($($json.homepage))"
|
|
return
|
|
}
|
|
|
|
$description = clean_description $description
|
|
|
|
write-host "(found by $descr_method)"
|
|
write-host " ""$description""" -fore green
|
|
|
|
}
|
|
|