Private/New-ReadMe.ps1
Function New-ReadMe { <# .SYNOPSIS Creates a basic README.md file. .DESCRIPTION This function creates a simple README.md file with a placeholder header for your project. .PARAMETER Path Required. The path where the README.md file will be created. .PARAMETER Name Required. The name of your project. This will be used in the header of the README.md file. .EXAMPLE New-ReadMe -Path C:\MyProject -Name AwesomeApp This creates a README.md file in "C:\MyProject" with the header "# AwesomeApp". .NOTES Author: owen.heaume Version: 1.0.0 - Initial release #> [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$Path, [Parameter(Mandatory)] [string]$Name ) Begin {} Process { $readMePath = Join-Path -Path $Path -ChildPath "README.md" $readMeContent = @" <Status badge goes Here> # $Name "@ try { Write-Host "Creating README.md file: $readMePath" -ForegroundColor DarkCyan if (Test-Path $readMePath) { Write-Host "README.md file already exists" -ForegroundColor DarkYellow } else { $readMeContent | Out-File -FilePath $readMePath -ea Stop Write-Host "README.md file created successfully" -ForegroundColor DarkGreen } } catch { throw "Error writing README.md file: $_" } } End {} } |