# encoding: ascii
# api: powershell
# title: Get-Parameter
# description: Not quite finished effort at a script intended to spit out the parameters of a cmdlet.  I’m sure there’s a better but this is…adequate for now.
# version: 0.1
# license: CC0
# x-poshcode-id: 186
# x-derived-from-id: 255
# x-archived: 2009-11-13T21:31:03
#
#
param($Cmdlet) $CmdletInfo = Get-Command -CommandType Cmdlet -Name $Cmdlet
    if ( $? ) {
        if ($CmdletInfo.GetType().Name -eq "CmdletInfo" ) {
            $parsed = $CmdletInfo.Definition `
                -replace "\] \[", "]`n[" `
                -replace "> \[", ">`n[" `
                -replace "$Cmdlet " `
                -split "`n" `
                -replace "\[-" `
                -replace "\]$"
            $parsed = $parsed | Sort-Object -Unique
            switch -regex ($parsed) {
                "^\["    { Write-host -ForegroundColor Green $_ }
                "Confirm|Debug|Verbose|WhatIf" { Write-Host -ForegroundColor Blue $_ }
                Default { Write-Host $_ }
            }
        }
    }
