Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide "Helper" Functions in Powershell Modules

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 
like image 422
icnivad Avatar asked May 17 '11 14:05

icnivad


1 Answers

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.

like image 186
Mike Shepard Avatar answered Sep 29 '22 10:09

Mike Shepard