Skip to content

Instantly share code, notes, and snippets.

@sassdawe
Created May 24, 2022 17:40
Show Gist options
  • Save sassdawe/19eec12c32c267d541fb040534cab0bf to your computer and use it in GitHub Desktop.
Save sassdawe/19eec12c32c267d541fb040534cab0bf to your computer and use it in GitHub Desktop.
Turn a monolit PowerShell module into multiple files for easier editing
$module = "module name"
$folder = "destination folder"
(((Get-Module $module).ExportedFunctions).Values.GetEnumerator()) | Foreach-Object {
"function $($_.Name) { `n $($_.definition)`n}" > "$folder\function-$($_.name).ps1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment