Skip to content

Instantly share code, notes, and snippets.

@turboBasic
Last active September 8, 2017 12:08
Show Gist options
  • Save turboBasic/439b82e8ddf05a4dee5e1bfc3c7e7371 to your computer and use it in GitHub Desktop.
Save turboBasic/439b82e8ddf05a4dee5e1bfc3c7e7371 to your computer and use it in GitHub Desktop.
[Disable some functions in Lee Holmes' Powershell Cookbook] so that not overwrite your existing functions. Run this, then open PowershellCookBook.psd1 and paste in `FunctionsToExport = ` line, then comment/delete functions you are not going to export. #powershell
New-Item -type Directory .\Module_PowershellCookBook
Save-Module -name PowerShellCookbook -path .\Module_PowershellCookBook
& {
$fileName = Get-ChildItem -path .\Module_PowershellCookBook\*\PowerShellCookbook.psm1 -recurse
$functions = Get-Content -path $fileName.fullName |
%{ Select-String '(?ix) ^(?<= \s*) function \s* ([-\w]+) \s* $' -input $_ -allMatches } |
%{ $_.Matches.Groups[1].Value }
($functions | %{ "'$_'" }) -join ",`n" | Out-Clipboard
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment