From 1810751d23fad24d2dd4145c28ce014696ac2bd1 Mon Sep 17 00:00:00 2001 From: Jake Bolton Date: Thu, 7 Dec 2023 10:01:53 -0600 Subject: [PATCH] updated export demo --- .../TestWhetherVariablesAreExported.short.psm1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Pwsh/Modules/TestWhetherVariablesAreExported.short.psm1 b/Pwsh/Modules/TestWhetherVariablesAreExported.short.psm1 index e2b8ec3..01f31aa 100644 --- a/Pwsh/Modules/TestWhetherVariablesAreExported.short.psm1 +++ b/Pwsh/Modules/TestWhetherVariablesAreExported.short.psm1 @@ -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