Skip to content

Commit

Permalink
updated export demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey committed Dec 7, 2023
1 parent 648c21f commit 1810751
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Pwsh/Modules/TestWhetherVariablesAreExported.short.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,23 @@ function ModVar.GetVar {
[string]$Scope )
Get-Variable mod* | ft -AutoSize | write-host
}
function Render.Array {
param( [string]$Name )
process {
$_ | Join-String -f "`n {0}" -op "$Name = [" -os "`n]"
}
}
function ModVar.ListImport { process {
$Mod = $_
,@($mod.ExportedVariables.Keys) | Render.Array 'Export Variablesname'
,@($mod.ExportedCommands.Keys) | Render.Array 'Export Commands'
} }
# test whether the location of 'Export-ModuleMember' has any affect
Module.OnLoad.BeforeExport
Export-ModuleMember -Function @('ModVar.*') -Variable @('ModVar_*')
Module.OnLoad.AfterExport

# 'ModVar_Exists', 'ModVar_Null', 'ModVar_OnLoad_AfterExport', 'ModVar_OnLoad_BeforeExport', 'ModVar_DidStuff'
# | Join-String -sep "`n" -SingleQuote -op 'To Look For: [ ' -os "`n ]"

# [1] Import normally, check whether Before and After vars exported

0 comments on commit 1810751

Please sign in to comment.