Public/Helpers/Add-Variable.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Add-Variable {
    [OutputType('Vaporshell.Helper.Variable')]
    [cmdletbinding()]
    Param
    (
      [parameter(Mandatory=$true,Position=0)]
      [ValidatePattern("[A-Za-z0-9-._~:/?#&=,]+")]
      [String]
      $Name,
      [parameter(Mandatory=$true,Position=1)]
      [String]
      $Value
    )
    $obj = [PSCustomObject]@{
        "$Name" = "$Value"
    }
    $obj | Add-ObjectDetail -TypeName 'Vaporshell.Helper.Variable'
}