PowerShell/Scripts/export-scripts2manuals.ps1

35 lines
887 B
PowerShell
Raw Normal View History

<#
.SYNOPSIS
2021-10-10 09:24:31 +02:00
Generates manuals from the scripts
.DESCRIPTION
2021-10-10 09:24:31 +02:00
This script exports the comment based help of all scripts to the manuals.
.EXAMPLE
2021-10-10 09:24:31 +02:00
PS> ./export-scripts2manuals.ps1
.NOTES
2021-10-10 09:24:31 +02:00
Author: Markus Fleschutz · License: CC0
.LINK
2021-10-10 09:24:31 +02:00
https://github.com/fleschutz/PowerShell
#>
2021-10-10 09:24:31 +02:00
#requires -version 2
2021-10-10 09:24:31 +02:00
param([string]$FilePattern = "$PSScriptRoot/*.ps1")
try {
2021-10-10 09:24:31 +02:00
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$Scripts = Get-ChildItem "$FilePattern"
"Found $($Scripts.Count) scripts, starting export..."
foreach ($Script in $Scripts) {
& "$PSScriptRoot/convert-ps2md" "$Script" > "$PSScriptRoot/../Docs/$($Script.BaseName).md"
}
2021-10-10 09:24:31 +02:00
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ exported $($Scripts.Count) scripts to manuals in $Elapsed sec"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}