Default psm1 Module Template PowerShell Code

title: ## Contents 
style: nestedList # TOC style (nestedList|inlineFirstLevel)
minLevel: 1 # Include headings from the specified level
maxLevel: 4 # Include headings up to the specified level
includeLinks: true # Make headings clickable
debugInConsole: false # Print debug info in Obsidian console

Overview

Sources:

  • **

Code Snippet

# MyModule.psm1
 
$PublicDir = Join-Path $PSScriptRoot "Public"
$PrivateDir = Join-Path $PSScriptRoot "Private"
$Public = Get-ChildItem -Path "$PublicDir\*.ps1"
$Private = Get-ChildItem -Path "$PrivateDir\*.ps1"
 
@($Public + $Private) | ForEach-Object {
  try {
    . $_.FullName
  } catch {
    Write-Error -Message "Failed to import function $($_.FullName): $_"
  }
}
 
Export-ModuleMember -Function $Public.BaseName

Details

About

This note is about …

See Also


Appendix

Note created on 2024-05-03 and last modified on 2024-05-03.

LIST FROM [[PowerShell - Default psm1 Module Template]] AND -"CHANGELOG" AND -"04-RESOURCES/Code/PowerShell/PowerShell - Default psm1 Module Template"

(c) No Clocks, LLC | 2024