fix(pwsh): move functions before module declaration

relates to #2318
This commit is contained in:
Jan De Dobbeleer 2022-05-25 05:59:12 +02:00 committed by Jan De Dobbeleer
parent f7e4661486
commit f3737cd91d

View file

@ -3,6 +3,8 @@ if ($null -ne (Get-Module -Name "oh-my-posh-core")) {
Remove-Module -Name "oh-my-posh-core" -Force
}
# Helper functions which need to be defined before the module is loaded
# See https://github.com/JanDeDobbeleer/oh-my-posh/discussions/2300
function Get-PoshStackCount {
$locations = Get-Location -Stack
if ($locations) {
@ -11,6 +13,9 @@ function Get-PoshStackCount {
return 0
}
# See https://github.com/JanDeDobbeleer/oh-my-posh/discussions/1928
function Test-PSDebugContext { return Test-Path Variable:/PSDebugContext }
New-Module -Name "oh-my-posh-core" -ScriptBlock {
$script:ErrorCode = 0
$script:OMPExecutable = '::OMP::'
@ -312,5 +317,3 @@ Example:
"prompt"
)
} | Import-Module -Global
function Test-PSDebugContext { return Test-Path Variable:/PSDebugContext }