From e12bff48a172b273a4ff7988ad078c4bbc93db54 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 25 Jan 2024 13:36:21 +0100 Subject: [PATCH] Updated convert-ps2md.ps1 and export-to-manuals.ps1 --- scripts/convert-ps2md.ps1 | 6 +++--- scripts/export-to-manuals.ps1 | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/convert-ps2md.ps1 b/scripts/convert-ps2md.ps1 index 76c36c96..969ce4c1 100755 --- a/scripts/convert-ps2md.ps1 +++ b/scripts/convert-ps2md.ps1 @@ -52,12 +52,12 @@ function GetRemark { param($Example) try { if ($filename -eq "") { $filename = Read-Host "Enter path to PowerShell script" } - $ScriptName = (Get-Item "$filename").Name + $ScriptName = (Get-Item "$filename").Name $full = Get-Help $filename -Full - "*$($ScriptName)*" - "================" + "Script: *$($ScriptName)*" + "========================" $Description = ($full.description | Out-String).Trim() if ($Description -ne "") { diff --git a/scripts/export-to-manuals.ps1 b/scripts/export-to-manuals.ps1 index c356ec17..6d1b0bf9 100755 --- a/scripts/export-to-manuals.ps1 +++ b/scripts/export-to-manuals.ps1 @@ -2,12 +2,12 @@ .SYNOPSIS Exports all scripts as manuals .DESCRIPTION - This PowerShell script exports the comment based help of all PowerShell scripts as manuals. + This PowerShell script exports the comment-based help of all PowerShell scripts as manuals. .EXAMPLE PS> ./export-to-manuals.ps1 ⏳ (1/2) Reading PowerShell scripts from /home/mf/PowerShell/scripts/*.ps1 ... ⏳ (2/2) Exporting Markdown manuals to /home/mf/PowerShell/docs ... - ✔️ Exported 518 Markdown manuals in 28 sec + ✔️ Exported 518 Markdown manuals in 28 sec. .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -16,21 +16,21 @@ #requires -version 2 -param([string]$FilePattern = "$PSScriptRoot/*.ps1", [string]$TargetDir = "$PSScriptRoot/../docs") +param([string]$filePattern = "$PSScriptRoot/*.ps1", [string]$targetDir = "$PSScriptRoot/../docs") try { - $StopWatch = [system.diagnostics.stopwatch]::startNew() + $stopWatch = [system.diagnostics.stopwatch]::startNew() - "⏳ (1/2) Reading PowerShell scripts from $FilePattern ..." - $Scripts = Get-ChildItem "$FilePattern" + "⏳ (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" + "⏳ (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" + [int]$elapsed = $stopWatch.Elapsed.TotalSeconds + "✔️ Exported $($scripts.Count) Markdown manuals in $elapsed sec." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"