Internal/Get-PsmFunctionContent.ps1
function Get-PsmFunctionContent { <# .Synopsis Get-PsmFunctionContent creates the function content .DESCRIPTION Get-PsmFunctionContent creates the function content .EXAMPLE Get-PsmFunctionContent Get-Something Get-PsmFunctionContent Get-Something -WhatIf #> [CmdletBinding(SupportsShouldProcess=$true)] param ( [Parameter( Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [string]$functionName ) BEGIN{ Write-Verbose "Starting Get-PsmFunctionContent..." }#begin PROCESS{ if ($psCmdlet.ShouldProcess(<# on target --> #>"$functionName", <# What if: Performing operation --> #>"Creating valid powershell function syntax.")) { "function $functionName { <# .Synopsis $functionName does this... Short description .DESCRIPTION $functionName does this, that, and the other... Long description .EXAMPLE $functionName `"DEV`" .\Here\this\path\file.txt #> [CmdletBinding(SupportsShouldProcess=`$true)] param ( [Parameter( Mandatory=`$true, ValueFromPipeline=`$true, ValueFromPipelineByPropertyName=`$true)] [ValidateSet(`"DEV`", `"STG`", `"PRD`")] [string]`$Environment, [Parameter( Mandatory=`$true, ValueFromPipeline=`$true, ValueFromPipelineByPropertyName=`$true)] [ValidateScript({Test-Path `$_ -PathType Any})] [string]`$Path ) BEGIN{ Write-Verbose `"Starting $functionName...`" }#begin PROCESS{ if (`$psCmdlet.ShouldProcess(<# on target --> #>`"target...`", <# What if: Performing operation --> #>`"operation...`")) { Write-Host `"Environment: `$Environment & Path: `$Path...`" } }#process END{ Write-Verbose `"Finished $functionName...`" }#end }" } }#process END{ Write-Verbose "Finished Get-PsmFunctionContent..." }#end } |