title: Powershell nested functions and parameters problem
body: <p>I'm trying to have two main functions that you can pass other functions to. For example</p>
  
  <p>./script.ps1 -local test1,test2</p>
  
  <p>Here is my code, and -local works and also asks for another input after, but it doesn't actually output test1.</p>
  
  <pre><code>[CmdletBinding(DefaultParameterSetName='default')]
  Param(
      [Parameter(ParameterSetName='default', Position=0, Mandatory=$true)]
      [string[]]$Default,
  
      [Parameter(ParameterSetName='external', Position=0, Mandatory=$true)]
      [string[]]$External,
  
      [Parameter(ParameterSetName='local', Position=0, Mandatory=$true)]
      [string[]]$Local
  )
  
  function RunLocal {
      switch ($PSCmdlet.ParameterSetName) {
          'Test1'  { Test1 }
          'Test2' { Test2 }
          }
          function Test1 {Write-Host "Test1"}
          function Test2 {Write-Host "Test2"}
      }
  function RunExternal {}
  function RunDefault {}
  
  switch ($PSCmdlet.ParameterSetName) {
      'local'    { RunLocal }
      'external' { RunExternal }
      'default'  { RunDefault }
  }
  </code></pre>