From 16aec1a40b45ba241ef2ac45ccf89de7206891be Mon Sep 17 00:00:00 2001 From: Richard Kuhnt Date: Wed, 21 Mar 2018 16:40:55 +0100 Subject: [PATCH] Save and load true/false values as booleans in scoops config --- lib/config.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/config.ps1 b/lib/config.ps1 index 50483b0a5..96b7d1605 100644 --- a/lib/config.ps1 +++ b/lib/config.ps1 @@ -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 }