PowerShell provides an easy way to view the contents of a function, for example.
Get-Content function:MyFuncName
or equivalent
(Get-ChildItem function:MyFuncName).definition
where MyFuncName is the name of my function. This is great for simple functions (i.e. Functions that use only the base language constructs and do not call other functions). But consider the function foo below, which contains a call to the bar function. In a typical scenario, they will be contained in the same module, the open API of which consists only of the function foo and, therefore, this is the only function exported.
function foo () { $p = bar "here" "result is '$p'" } function bar ([string] $s) { $s + $s } Export-ModuleMember foo
Is there a way to view nested, unexported functions (e.g. bar function) in another function compared to (A) or (B) above? (That is, without opening the .psm1 file in the editor :-)
source share