public/New-PSUScriptModule.ps1
|
function New-PSUScriptModule { <# .SYNOPSIS Creates a PowerShell Universal script module from the Plaster template. .DESCRIPTION Scaffolds a module with a sample script command and .universal script registration. .PARAMETER DestinationPath The path where the new module should be created. .PARAMETER ModuleName The full module name. .PARAMETER ScriptName The name used for the sample script command. .PARAMETER Description A brief description for the module. .PARAMETER Author The author name for the module. .PARAMETER Version The version number for the module. Default is '1.0.0'. #> [CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory)] [string] $DestinationPath, [Parameter()] [string] $ModuleName, [Parameter()] [string] $ScriptName, [Parameter()] [string] $Description, [Parameter()] [string] $Author, [Parameter()] [string] $Version ) $templateParameters = @{} foreach ($name in 'ModuleName', 'ScriptName', 'Description', 'Author', 'Version') { if ($PSBoundParameters.ContainsKey($name)) { $templateParameters[$name] = $PSBoundParameters[$name] } } if ($PSCmdlet.ShouldProcess($DestinationPath, 'Create new PSU Script Module')) { Invoke-PSUModuleTemplate -TemplateName 'PowerShellUniversalScript' -DestinationPath $DestinationPath -TemplateParameters $templateParameters } } |