initial Commit
This commit is contained in:
35
Private/Invoke-ConfigurationDataExpressionArgument.ps1
Normal file
35
Private/Invoke-ConfigurationDataExpressionArgument.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
function Invoke-ConfigurationDataExpressionArgument {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[AllowNull()]
|
||||
[string]
|
||||
$Argument,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
$Context
|
||||
)
|
||||
|
||||
if($null -eq $Argument){
|
||||
return $null
|
||||
}
|
||||
|
||||
$Argument = $Argument.Trim()
|
||||
|
||||
if($Argument -match "^'(.*)'$"){
|
||||
return $Matches[1]
|
||||
}
|
||||
|
||||
if($Argument -match "^-?\d+$"){
|
||||
return [int]$Argument
|
||||
}
|
||||
|
||||
if($Argument -match "^(?i:true|false)$"){
|
||||
return [bool]::Parse($Argument)
|
||||
}
|
||||
|
||||
if($Argument -match "^[A-Za-z][A-Za-z0-9]*\(.*\)$"){
|
||||
return Invoke-ConfigurationDataExpression -Expression $Argument -Context $Context
|
||||
}
|
||||
|
||||
return $Argument
|
||||
}
|
||||
Reference in New Issue
Block a user