-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP on "cleaning" help after platyps
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
function Convert-HelpToExternalFile { | ||
<# | ||
.SYNOPSIS | ||
Remove the Comment-based help section from the file and replace with a .EXTERNALHELPFILE line | ||
#> | ||
[CmdletBinding()] | ||
param( | ||
# Specifies a path to one or more files with a function defined. | ||
[Parameter( | ||
Position = 0, | ||
ValueFromPipeline, | ||
ValueFromPipelineByPropertyName | ||
)] | ||
[Alias('PSPath')] | ||
[string[]]$Path, | ||
|
||
# The name of the external file | ||
[Parameter( | ||
)] | ||
[string]$HelpFile | ||
|
||
) | ||
begin { | ||
Write-Debug "`n$('-' * 80)`n-- Begin $($MyInvocation.MyCommand.Name)`n$('-' * 80)" | ||
$keywords = @('.SYNOPSIS', '.DESCRIPTION', '.EXAMPLE', '.NOTES') | ||
} | ||
process { | ||
foreach ($file in $Path) { | ||
if ($file | Test-Path) { | ||
try { | ||
#TODO: Get the tokens of the file, replace the help comment token | ||
} | ||
catch { | ||
$PSCmdlet.ThrowTerminatingError($_) | ||
} | ||
} | ||
} | ||
} | ||
end { | ||
Write-Debug "`n$('-' * 80)`n-- End $($MyInvocation.MyCommand.Name)`n$('-' * 80)" | ||
} | ||
} |