File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4039,48 +4039,6 @@ function Test-PodeIsISEHost {
40394039}
40404040
40414041
4042- <#
4043- . SYNOPSIS
4044- Retrieves the name of the main Pode application script.
4045-
4046- . DESCRIPTION
4047- The `Get-PodeApplicationName` function determines the name of the primary script (`.ps1`)
4048- that started execution. It does this by examining the PowerShell call stack and
4049- extracting the first script file that appears.
4050-
4051- If no script file is found in the call stack, the function returns `"NoName"`.
4052-
4053- . OUTPUTS
4054- [string]
4055- Returns the filename of the main application script, or `"NoName"` if no script is found.
4056-
4057- . EXAMPLE
4058- Get-PodeApplicationName
4059-
4060- This retrieves the name of the main script that launched the Pode application.
4061-
4062- . EXAMPLE
4063- $AppName = Get-PodeApplicationName
4064- Write-Host "Application Name: $AppName"
4065-
4066- This stores the retrieved application name in a variable and prints it.
4067-
4068- . NOTES
4069- - This function relies on `Get-PSCallStack`, meaning it must be run within a script execution context.
4070- - If called interactively or if no `.ps1` script is in the call stack, it will return `"NoName"`.
4071- - This is an internal function and may change in future releases of Pode.
4072- #>
4073- function Get-PodeApplicationName {
4074- $scriptFrame = (Get-PSCallStack | Where-Object { $_.Command -match ' \.ps1$' } | Select-Object - First 1 )
4075- if ($scriptFrame ) {
4076- return [System.IO.Path ]::GetFileNameWithoutExtension($scriptFrame.Command )
4077-
4078- }
4079- else {
4080- return ' NoName'
4081- }
4082- }
4083-
40844042<#
40854043 . SYNOPSIS
40864044 Displays a deprecation warning message for a function.
You can’t perform that action at this time.
0 commit comments