2024-02-16 08:57:13 +08:00
|
|
|
# fetch repo url by name
|
2023-12-20 02:34:45 +08:00
|
|
|
param(
|
|
|
|
$name,
|
2024-03-24 05:11:41 +08:00
|
|
|
$manifest_file
|
2023-12-20 02:34:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
$mirror = if (!(Test-Path (Join-Path $PSScriptRoot '.gitee') -PathType Leaf)) {'github'} else {'gitee'}
|
|
|
|
$url_base = @{'github' = 'https://github.com/'; 'gitee' = 'https://gitee.com/' }[$mirror]
|
|
|
|
|
2024-03-24 05:11:41 +08:00
|
|
|
$manifest_map = ConvertFrom-Json (Get-Content $manifest_file -raw)
|
2023-12-20 02:34:45 +08:00
|
|
|
$ver = $manifest_map.versions.PSObject.Properties[$name].Value
|
|
|
|
$url_path = $manifest_map.mirrors.PSObject.Properties[$mirror].Value.PSObject.Properties[$name].Value
|
|
|
|
|
|
|
|
Write-Host "$url_base$url_path#$ver" -NoNewline
|