ps/Modules/.build/Get-FunctionNames.ps1

31 lines
862 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
Function Get-FunctionNames {
<#
.SYNOPSIS
Collects all function names from filenames. Assumes Test-FunctionNames properly ran.
.EXAMPLE
Get-FunctionNames .\Alkami.PowerShell.IIS\Public
.PARAMETER FolderPath
The name of the folder to examine all files under.
#>
[CmdletBinding()]
Param (
[String]$FolderPath
)
process {
$functionNames = @()
$verbs = Get-Verb | Select-Object -ExpandProperty Verb
$files = (Get-ChildItem -Path $FolderPath *.ps1)
foreach($file in $files) {
if ($file.BaseName.ToLower().EndsWith(".tests") -or $file.BaseName.ToLower().EndsWith(".test")) {
Write-Verbose "skipping function names of test $file"
} else {
$functionNames += $file.BaseName
}
}
return $functionNames
}
}