Private/Add-SpecModuleHelp.ps1
function Add-SpecModuleHelp { [cmdletbinding()] param ( [parameter (mandatory = $true)] [string]$moduleName, [parameter (mandatory = $true)] [string]$modulePath, [parameter (mandatory = $true)] [string]$moduleShortDescription ) begin { $fullModulePath = Join-Path $modulePath $moduleName # .psm1 module loader code $moduleHelpText = @" TOPIC about_$moduleName SHORT DESCRIPTION $moduleShortDescription LONG DESCRIPTION EXAMPLES KEYWORDS SEE ALSO "@ } process { # Create module help file try { $fullModulePath = join-path $ModulePath $modulename #write-host "$fullModulePath" -ForegroundColor Green $enUSDir = Join-Path $fullModulePath "en-US" $fileName = "about_$moduleName.help.txt" Write-Verbose "Creating module help file: $enUSDir\$fileName" new-item -path $enUSDir -Name $fileName -ItemType File | Out-Null -ea stop -ev x Set-Content -Path (Join-Path $enUSDir $fileName) -Value $moduleHelpText -ea Stop -ev x return $true } catch { write-warning "Unable to create module help file: $enUSDir\$fileName" Write-warning "The error was $x" return $false } } } |