Private/New-AboutFile.ps1

Function New-AboutFile {
    <#
    .SYNOPSIS
        Creates a basic 'about_' help file for a PowerShell module.
 
    .DESCRIPTION
        This function generates a standard 'about_' help file, including sections for a short description,
        long description, examples, keywords, and 'See Also' references.
 
    .PARAMETER Path
        Required. Specifies the absolute path where the 'about_' file will be created.
 
    .PARAMETER Name
        Required. The name of the module.
 
    .PARAMETER moduleShortDescription
        Required. A brief description of the module's functionality.
 
    .EXAMPLE
        New-AboutFile -Path C:\MyProject\Help -Name MyModule -moduleShortDescription "Provides tools for data analysis"
        This creates a file named "about_MyModule.help.txt" in the "C:\MyProject\Help" directory.
 
    .NOTES
        Author: owen.heaume
        Version: 1.0.0 - Initial release
    #>


    [CmdletBinding()]

    param (
        [Parameter(Mandatory)]
        [string]$Path,

        [Parameter(Mandatory)]
        [string]$Name,

        [Parameter(Mandatory)]
        [string]$moduleShortDescription
    )

    Begin {}

    Process {
        $aboutPath = Join-Path -Path $Path -ChildPath "about_$Name.help.txt"
        $aboutContent = @"
TOPIC
    about_$Name
 
SHORT DESCRIPTION
    $moduleShortDescription
 
LONG DESCRIPTION
 
 
EXAMPLES
 
 
KEYWORDS
 
 
SEE ALSO
"@


        try {
            Write-Host "Creating About.md file: $aboutPath" -ForegroundColor DarkCyan
            if (Test-Path $aboutPath) {
                Write-Host "About.md file already exists" -ForegroundColor DarkYellow
            } else {
                $aboutContent | Out-File -FilePath $aboutPath -ea Stop
                Write-Host "About file created successfully" -ForegroundColor DarkGreen
            }
        } catch {
            throw "Error writing About file: $_"
        }
    }

    End {}
}