Private/Add-SpecReadMeFile.ps1

Function Add-SpecReadMeFile {
    <#
    .SYNOPSIS
    Creates a README.md file for a specified PowerShell module.
 
    .DESCRIPTION
    The Add-SpecReadMeFile function generates a README.md file for a PowerShell module. It creates a Markdown file with the name "README.md" in the module's root directory.
 
    .PARAMETER moduleName
    Specifies the name of the module.
 
    .PARAMETER modulePath
    Specifies the path to the module's root directory.
 
    .EXAMPLE
    Add-SpecReadMeFile -moduleName "MyModule" -modulePath "C:\Path\To\Module"
 
    This example creates a README.md file for a module named "MyModule" located at "C:\Path\To\Module".
 
    .NOTES
    Author : owen.heaume
    Version : 1.1
    #>


    [cmdletbinding()]

    param (
        [parameter (mandatory = $true)]
        [string]$moduleName,

        [parameter (mandatory = $true)]
        [string]$modulePath
    )

    $fullModulePath = Join-Path "$modulePath" $moduleName

    try {
        Write-verbose "Creating $fullmodulepath\README.md"
        new-item -Path $fullModulePath -Name "README.md" -ItemType File
        return $true
    } catch {
        return $false
    }
}