mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-09-30 01:05:58 +00:00
Save and load true/false values as booleans in scoops config
This commit is contained in:
@@ -25,6 +25,9 @@ function hashtable_val($obj) {
|
||||
if($obj.gettype().name -eq 'pscustomobject') { # -is is unreliable
|
||||
return hashtable $obj
|
||||
}
|
||||
if($obj -eq [bool]::TrueString -or $obj -eq [bool]::FalseString) {
|
||||
$obj = [System.Convert]::ToBoolean($obj)
|
||||
}
|
||||
return $obj # assume primitive
|
||||
}
|
||||
|
||||
@@ -46,6 +49,9 @@ function set_config($name, $val) {
|
||||
if(!$cfg) {
|
||||
$cfg = @{ $name = $val }
|
||||
} else {
|
||||
if($val -eq [bool]::TrueString -or $val -eq [bool]::FalseString) {
|
||||
$val = [System.Convert]::ToBoolean($val)
|
||||
}
|
||||
$cfg.$name = $val
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user