Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a module xy which has several functions for the end user and several internal helper functions called by functions but not by the end user.

Get-Command -Module xy -CommandType function

lists all functions I have in my module folder (e.g. get-foo and get-foo_helper)

Is there a way to hide get-foo_helper function from the end user who is using:

Get-Command -Module tcaps -CommandType function
question from:https://stackoverflow.com/questions/6032344/how-to-hide-helper-functions-in-powershell-modules

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
79 views
Welcome To Ask or Share your Answers For Others

1 Answer

One thing I have done is use the verb-noun naming convention for functions I want to export, but leave out the hyphen in helper functions.

Then, export-modulemember *-* takes care of only exporting what you want to export.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...