Skip to content

export-to-manuals

Exports all scripts as manuals

#Requires -Version 5.1

#requires -version 2

param([string]$filePattern = "$PSScriptRoot/*.ps1", [string]$targetDir = "$PSScriptRoot/../docs")

try {
	$stopWatch = [system.diagnostics.stopwatch]::startNew()

	"⏳ (1/2) Reading PowerShell scripts from $filePattern ..." 
	$scripts = Get-ChildItem "$filePattern"

	"⏳ (2/2) Exporting Markdown manuals to $targetDir ..."
	foreach ($script in $scripts) {
		& "$PSScriptRoot/convert-ps2md.ps1" "$script" > "$targetDir/$($script.BaseName).md"
	}

	[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
	"✅ Exported $($scripts.Count) Markdown manuals in $elapsed sec."
	exit 0
} catch {
throw
}

An interactive directory of PowerShell scripts.