|
2 | 2 | .SYNOPSIS
|
3 | 3 | Exports all scripts as manuals
|
4 | 4 | .DESCRIPTION
|
5 |
| - This PowerShell script exports the comment based help of all PowerShell scripts as manuals. |
| 5 | + This PowerShell script exports the comment-based help of all PowerShell scripts as manuals. |
6 | 6 | .EXAMPLE
|
7 | 7 | PS> ./export-to-manuals.ps1
|
8 | 8 | ⏳ (1/2) Reading PowerShell scripts from /home/mf/PowerShell/scripts/*.ps1 ...
|
9 | 9 | ⏳ (2/2) Exporting Markdown manuals to /home/mf/PowerShell/docs ...
|
10 |
| - ✔️ Exported 518 Markdown manuals in 28 sec |
| 10 | + ✔️ Exported 518 Markdown manuals in 28 sec. |
11 | 11 | .LINK
|
12 | 12 | https://github.com/fleschutz/PowerShell
|
13 | 13 | .NOTES
|
|
16 | 16 |
|
17 | 17 | #requires -version 2
|
18 | 18 |
|
19 |
| -param([string]$FilePattern = "$PSScriptRoot/*.ps1", [string]$TargetDir = "$PSScriptRoot/../docs") |
| 19 | +param([string]$filePattern = "$PSScriptRoot/*.ps1", [string]$targetDir = "$PSScriptRoot/../docs") |
20 | 20 |
|
21 | 21 | try {
|
22 |
| - $StopWatch = [system.diagnostics.stopwatch]::startNew() |
| 22 | + $stopWatch = [system.diagnostics.stopwatch]::startNew() |
23 | 23 |
|
24 |
| - "⏳ (1/2) Reading PowerShell scripts from $FilePattern ..." |
25 |
| - $Scripts = Get-ChildItem "$FilePattern" |
| 24 | + "⏳ (1/2) Reading PowerShell scripts from $filePattern ..." |
| 25 | + $scripts = Get-ChildItem "$filePattern" |
26 | 26 |
|
27 |
| - "⏳ (2/2) Exporting Markdown manuals to $TargetDir ..." |
28 |
| - foreach ($Script in $Scripts) { |
29 |
| - & "$PSScriptRoot/convert-ps2md.ps1" "$Script" > "$TargetDir/$($Script.BaseName).md" |
| 27 | + "⏳ (2/2) Exporting Markdown manuals to $targetDir ..." |
| 28 | + foreach ($script in $scripts) { |
| 29 | + & "$PSScriptRoot/convert-ps2md.ps1" "$script" > "$targetDir/$($script.BaseName).md" |
30 | 30 | }
|
31 | 31 |
|
32 |
| - [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds |
33 |
| - "✔️ Exported $($Scripts.Count) Markdown manuals in $Elapsed sec" |
| 32 | + [int]$elapsed = $stopWatch.Elapsed.TotalSeconds |
| 33 | + "✔️ Exported $($scripts.Count) Markdown manuals in $elapsed sec." |
34 | 34 | exit 0 # success
|
35 | 35 | } catch {
|
36 | 36 | "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
0 commit comments