mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-31 17:28:06 +00:00
docs: update cmdlet help via platyPS merge, fix generate-help.ps1
- generate-help.ps1: rewritten to use Update-MarkdownHelp (merge) by default, preserving hand-written descriptions and examples. Only New-MarkdownHelp on genuinely new cmdlets. -Force flag for full regen. - docs/cmdlets: parameter metadata updated via platyPS merge, CRLF normalized to LF - Removed stale Send-PveIso.md (cmdlet renamed to Send-PveFile) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+47
-10
@@ -1,20 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Generates platyPS markdown help stubs and MAML XML help for PSProxmoxVE.
|
||||
Generates platyPS markdown help and MAML XML help for PSProxmoxVE.
|
||||
|
||||
.DESCRIPTION
|
||||
This script:
|
||||
1. Builds the module to publish/netstandard2.0/
|
||||
2. Installs platyPS if needed
|
||||
3. Generates markdown help stubs in docs/cmdlets/
|
||||
4. Generates MAML XML help in publish/netstandard2.0/
|
||||
5. Copies the MAML XML to src/PSProxmoxVE/ for inclusion in builds
|
||||
3. Creates markdown stubs for NEW cmdlets only (preserves existing docs)
|
||||
4. Updates existing markdown docs (merges parameter changes, preserves descriptions/examples)
|
||||
5. Generates MAML XML help from the markdown
|
||||
6. Copies the MAML XML to src/PSProxmoxVE/ for inclusion in builds
|
||||
|
||||
.PARAMETER Force
|
||||
Regenerate all markdown from scratch, overwriting hand-written content.
|
||||
Use with caution — this will replace all descriptions and examples.
|
||||
|
||||
.NOTES
|
||||
Run from the repository root:
|
||||
pwsh -NoProfile -File ./generate-help.ps1
|
||||
#>
|
||||
param(
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-StrictMode -Version Latest
|
||||
@@ -25,7 +33,10 @@ Push-Location $repoRoot
|
||||
try {
|
||||
# Step 1: Build the module
|
||||
Write-Host "Building module..." -ForegroundColor Cyan
|
||||
dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework netstandard2.0 --output ./publish/netstandard2.0 | Out-Null
|
||||
dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj `
|
||||
--configuration Release `
|
||||
--framework netstandard2.0 `
|
||||
--output ./publish/netstandard2.0 | Out-Null
|
||||
Remove-Item ./publish/netstandard2.0/*.deps.json, ./publish/netstandard2.0/*.runtimeconfig.json -ErrorAction SilentlyContinue
|
||||
|
||||
# Step 2: Install platyPS if needed
|
||||
@@ -45,14 +56,40 @@ try {
|
||||
New-Item -ItemType Directory -Path $docsDir -Force | Out-Null
|
||||
}
|
||||
|
||||
# Step 5: Generate markdown help stubs
|
||||
Write-Host "Generating markdown help stubs..." -ForegroundColor Cyan
|
||||
New-MarkdownHelp -Module PSProxmoxVE -OutputFolder $docsDir -Force | Out-Null
|
||||
# Step 5: Generate or update markdown help
|
||||
$existingDocs = Get-ChildItem "$docsDir/*.md" -ErrorAction SilentlyContinue
|
||||
|
||||
if ($Force -or $existingDocs.Count -eq 0) {
|
||||
# Full generation — creates all markdown from scratch
|
||||
Write-Host "Generating all markdown help (full)..." -ForegroundColor Cyan
|
||||
New-MarkdownHelp -Module PSProxmoxVE -OutputFolder $docsDir -Force | Out-Null
|
||||
}
|
||||
else {
|
||||
# Update existing docs: merge parameter/syntax changes, preserve descriptions & examples
|
||||
Write-Host "Updating existing markdown help (merge)..." -ForegroundColor Cyan
|
||||
Update-MarkdownHelp -Path $docsDir -Force | Out-Null
|
||||
|
||||
# Create stubs for any NEW cmdlets not yet documented
|
||||
$documentedCmdlets = @($existingDocs | ForEach-Object { $_.BaseName })
|
||||
$moduleCmdlets = @((Get-Command -Module PSProxmoxVE -CommandType Cmdlet).Name)
|
||||
$newCmdlets = @($moduleCmdlets | Where-Object { $_ -notin $documentedCmdlets })
|
||||
|
||||
if ($newCmdlets.Count -gt 0) {
|
||||
Write-Host " Creating stubs for $($newCmdlets.Count) new cmdlet(s):" -ForegroundColor Yellow
|
||||
foreach ($cmdlet in $newCmdlets) {
|
||||
Write-Host " + $cmdlet" -ForegroundColor Yellow
|
||||
New-MarkdownHelp -Command $cmdlet -OutputFolder $docsDir -Force | Out-Null
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host " No new cmdlets to document" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
$mdCount = (Get-ChildItem "$docsDir/*.md" | Measure-Object).Count
|
||||
Write-Host " Generated $mdCount markdown files" -ForegroundColor Green
|
||||
Write-Host " Markdown files: $mdCount" -ForegroundColor Green
|
||||
|
||||
# Step 6: Generate MAML XML help
|
||||
# Step 6: Generate MAML XML help from markdown
|
||||
Write-Host "Generating MAML XML help..." -ForegroundColor Cyan
|
||||
New-ExternalHelp -Path $docsDir -OutputPath ./publish/netstandard2.0/ -Force | Out-Null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user