Public/WatchmenOptions.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function WatchmenOptions {
    [cmdletbinding()]
    param(
        [scriptblock]$Script
    )

    begin {
        Write-Debug -Message "Entering: $($PSCmdlet.MyInvocation.MyCommand.Name)"
        # Mark that we are inside an 'WatchmenOptions' block and subsequent commands are allowed
        $script:Watchmen.InConfig = $true
    }

    process {
        # Execute any functions passed in
        . $Script
    }

    end {
        # Mark that we have exited the 'WatchmenOptions' block
        $script:Watchmen.InConfig = $false

        Write-Debug -Message "Exiting: $($PSCmdlet.MyInvocation.MyCommand.Name)"
    }
}