Skip to content

Commit

Permalink
Merge pull request #129 from StartAutomating/HelpOut-Safety
Browse files Browse the repository at this point in the history
HelpOut 0.4.6
  • Loading branch information
StartAutomating authored Jun 4, 2023
2 parents bc2ae8b + 1473665 commit 820aa6f
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### HelpOut 0.4.6:

* Save-MarkdownHelp: Improving resiliency (Fixes #128)

---

### HelpOut 0.4.5:

* You can now sponsor HelpOut (#126)
Expand Down
16 changes: 8 additions & 8 deletions HelpOut-Help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<maml:description>
<maml:para>Gets MAML help</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Gets help for a given command, as MAML (Microsoft Assistance Markup Language) xml.</maml:para>
Expand Down Expand Up @@ -400,7 +400,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
<maml:description>
<maml:para>Gets Markdown Help</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Gets Help for a given command, in Markdown</maml:para>
Expand Down Expand Up @@ -666,7 +666,7 @@ If not provided, this will be the order they are defined in the formatter.</maml
<maml:description>
<maml:para>Gets a script's references</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Gets the external references of a given PowerShell command. These are the commands the script calls, and the types the script uses.</maml:para>
Expand Down Expand Up @@ -792,7 +792,7 @@ If not provided, this will be the order they are defined in the formatter.</maml
<maml:description>
<maml:para>Gets a Script's story</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Gets the Script's "Story"</maml:para>
Expand Down Expand Up @@ -955,7 +955,7 @@ If not provided, this will be the order they are defined in the formatter.</maml
<maml:description>
<maml:para>Installs MAML into a module</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Installs MAML into a module. </maml:para>
Expand Down Expand Up @@ -1309,7 +1309,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
<maml:description>
<maml:para>Determines the percentage of documentation</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Determines the percentage of documentation in a given script</maml:para>
Expand Down Expand Up @@ -1452,7 +1452,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
<maml:description>
<maml:para>Saves a Module's MAML</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Generates a Module's MAML file, and then saves it to the appropriate location.</maml:para>
Expand Down Expand Up @@ -1713,7 +1713,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
<maml:description>
<maml:para>Saves a Module's Markdown Help</maml:para>
</maml:description>
<dev:version>0.4.5</dev:version>
<dev:version>0.4.6</dev:version>
</command:details>
<maml:description>
<maml:para>Get markdown help for each command in a module and saves it to the appropriate location.</maml:para>
Expand Down
4 changes: 4 additions & 0 deletions HelpOut.SaveMarkdownHelp.ExtendedTypes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ foreach ($extendedType in $extendedTypeNames) {
$ExecutionContext.SessionState.PSVariable.Set("function:$($temporaryFunctionName)", $member.$PotentialProperty)
# Then Get-MarkdownHelp,
$markdownHelp = Get-MarkdownHelp -Name $temporaryFunctionName @getMarkdownHelpSplatBase @markdownSplat
if ($markdownHelp -is [string]) {
$ExecutionContext.SessionState.PSVariable.Remove("function:$($temporaryFunctionName)")
continue
}
$markdownHelp.HideSection("Syntax")
# .Save it,
$markdownHelp.Save((Join-Path $outputPath "$($temporaryFunctionName).md"))
Expand Down
12 changes: 4 additions & 8 deletions HelpOut.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,20 @@
ModuleToProcess='HelpOut.psm1'
FormatsToProcess='HelpOut.format.ps1xml'
TypesToProcess='HelpOut.types.ps1xml'
ModuleVersion='0.4.5'
ModuleVersion='0.4.6'
PrivateData = @{
PSData = @{
ProjectURI = 'https://github.com/StartAutomating/HelpOut'
LicenseURI = 'https://github.com/StartAutomating/HelpOut/blob/master/LICENSE'

Tags = 'Markdown', 'Help','PowerShell'
ReleaseNotes = @'
### HelpOut 0.4.5:
### HelpOut 0.4.6:
* You can now sponsor HelpOut (#126)
* Added ScriptMethods to PowerShell.Markdown.Help (#125)
* Now allowing Save-MarkDownHelp to be extended by any HelpOut.SaveMarkdownHelp file or function (#123)
* This is used in HelpOut.SaveMarkdownHelp.ExtendedTypes, which auto documents extended types (#101)
* Save-MarkdownHelp: Improving resiliency (Fixes #128)
---
Additional Changes in [ChangeLog](/CHANGELOG.md)
Additional Changes in [Changelog](/CHANGELOG.md)
'@
}
}
Expand Down
21 changes: 17 additions & 4 deletions Save-MarkdownHelp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,13 @@
# otherwise, pass down the parent of $OutputPath.
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}

$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
$markdownFile =
if ($markdownTopic.Save) {
$markdownTopic.Save($docOutputPath)
} else { $null }

$markdownFile = (Get-MarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
$filesChanged += $markdownFile

if ($PassThru) { # If -PassThru was provided, get the path.
$markdownFile
Expand Down Expand Up @@ -264,7 +269,11 @@
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}

try {
$markdownFile = (Get-MarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
$markdownFile =
if ($markdownTopic.Save) {
$markdownTopic.Save($docOutputPath)
} else { $null }
}
catch {
$ex = $_
Expand Down Expand Up @@ -329,8 +338,12 @@
if ($Wiki) { $getMarkdownHelpSplat.Wiki = $Wiki}
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}
# Call Get-MarkdownHelp, .Save it, and
$markdownFile = (& $GetMarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)

$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
$markdownFile =
if ($markdownTopic.Save) {
$markdownTopic.Save($docOutputPath)
} else { $null }

$filesChanged += $markdownFile # add the file to the changed list.

# If -PassThru was provided (and we're not going to change anything)
Expand Down
21 changes: 17 additions & 4 deletions allcommands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1636,8 +1636,13 @@ function Save-MarkdownHelp
# otherwise, pass down the parent of $OutputPath.
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}

$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
$markdownFile =
if ($markdownTopic.Save) {
$markdownTopic.Save($docOutputPath)
} else { $null }

$markdownFile = (Get-MarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
$filesChanged += $markdownFile

if ($PassThru) { # If -PassThru was provided, get the path.
$markdownFile
Expand Down Expand Up @@ -1675,7 +1680,11 @@ function Save-MarkdownHelp
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}

try {
$markdownFile = (Get-MarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
$markdownFile =
if ($markdownTopic.Save) {
$markdownTopic.Save($docOutputPath)
} else { $null }
}
catch {
$ex = $_
Expand Down Expand Up @@ -1740,8 +1749,12 @@ function Save-MarkdownHelp
if ($Wiki) { $getMarkdownHelpSplat.Wiki = $Wiki}
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}
# Call Get-MarkdownHelp, .Save it, and
$markdownFile = (& $GetMarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)

$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
$markdownFile =
if ($markdownTopic.Save) {
$markdownTopic.Save($docOutputPath)
} else { $null }

$filesChanged += $markdownFile # add the file to the changed list.

# If -PassThru was provided (and we're not going to change anything)
Expand Down
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### HelpOut 0.4.6:

* Save-MarkdownHelp: Improving resiliency (Fixes #128)

---

### HelpOut 0.4.5:

* You can now sponsor HelpOut (#126)
Expand Down

0 comments on commit 820aa6f

Please sign in to comment.