Save and load true/false values as booleans in scoops config

This commit is contained in:
Richard Kuhnt
2018-03-21 16:40:55 +01:00
parent 0daa25c630
commit 16aec1a40b
+6
View File
@@ -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
}