mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-25 16:18:55 +01:00
Updated convert-ps2md.ps1 and export-to-manuals.ps1
This commit is contained in:
parent
46a49b5291
commit
e12bff48a1
@ -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 "") {
|
||||
|
@ -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])"
|
||||
|
Loading…
Reference in New Issue
Block a user