Private/New-FunctionsFile.ps1

Function New-FunctionsFile {
    <#
    .SYNOPSIS
    Creates an empty Functions.ps1 file in the specified path.
 
    .DESCRIPTION
    This function is designed to create a blank Functions.ps1 file within your project structure.
    This file is commonly used to store user-defined PowerShell functions.
 
    .PARAMETER Path
    Required. Specifies the directory path where the Functions.ps1 file will be created.
 
    .EXAMPLE
    New-FunctionsFile -Path C:\MyProject\src
    This creates an empty Functions.ps1 file in the "C:\MyProject\src" directory.
 
    .NOTES
    Author: owen.heaume
    Version: 1.0.0 - Initial release
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory)]
        [string]$Path
    )
    Begin {
        Write-Host "Creating Functions.ps1 file" -ForegroundColor DarkCyan
    }

    Process {

        try {
            $FunctionsPath = Join-Path -Path $Path -ChildPath "Functions.ps1" -ea Stop
        } catch {
            throw "Error joining path: $_"
        }

        if (Test-Path $FunctionsPath) {
            Write-Host "Functions.ps1 file already exists" -ForegroundColor DarkYellow
        } else {
            try {
                New-Item -Path $FunctionsPath -ItemType File -ea Stop | Out-Null
                Write-Host "Functions.ps1 file created successfully" -ForegroundColor DarkGreen
            } catch {
                throw "Error creating Functions.ps1 file: $_"
            }
        }
    }
}