mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-10-01 09:47:12 +00:00
core.substitute() for arrays (#2048)
This commit is contained in:
committed by
Richard Kuhnt
parent
51a780e299
commit
128262191b
+8
-4
@@ -450,11 +450,15 @@ function is_scoop_outdated() {
|
||||
return $last_update -lt $now.ToLocalTime()
|
||||
}
|
||||
|
||||
function substitute([String] $str, [Hashtable] $params) {
|
||||
$params.GetEnumerator() | % {
|
||||
$str = $str.Replace($_.Name, $_.Value)
|
||||
function substitute($entity, [Hashtable] $params) {
|
||||
if ($entity -is [Array]) {
|
||||
return $entity | % { substitute $_ $params }
|
||||
} elseif ($entity -is [String]) {
|
||||
$params.GetEnumerator() | % {
|
||||
$entity = $entity.Replace($_.Name, $_.Value)
|
||||
}
|
||||
return $entity
|
||||
}
|
||||
return $str
|
||||
}
|
||||
|
||||
function format_hash([String] $hash) {
|
||||
|
||||
Reference in New Issue
Block a user