Skip to content

Commit 820aa6f

Browse files
Merge pull request #129 from StartAutomating/HelpOut-Safety
HelpOut 0.4.6
2 parents bc2ae8b + 1473665 commit 820aa6f

7 files changed

Lines changed: 62 additions & 24 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### HelpOut 0.4.6:
2+
3+
* Save-MarkdownHelp: Improving resiliency (Fixes #128)
4+
5+
---
6+
17
### HelpOut 0.4.5:
28

39
* You can now sponsor HelpOut (#126)

HelpOut-Help.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<maml:description>
99
<maml:para>Gets MAML help</maml:para>
1010
</maml:description>
11-
<dev:version>0.4.5</dev:version>
11+
<dev:version>0.4.6</dev:version>
1212
</command:details>
1313
<maml:description>
1414
<maml:para>Gets help for a given command, as MAML (Microsoft Assistance Markup Language) xml.</maml:para>
@@ -400,7 +400,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
400400
<maml:description>
401401
<maml:para>Gets Markdown Help</maml:para>
402402
</maml:description>
403-
<dev:version>0.4.5</dev:version>
403+
<dev:version>0.4.6</dev:version>
404404
</command:details>
405405
<maml:description>
406406
<maml:para>Gets Help for a given command, in Markdown</maml:para>
@@ -666,7 +666,7 @@ If not provided, this will be the order they are defined in the formatter.</maml
666666
<maml:description>
667667
<maml:para>Gets a script's references</maml:para>
668668
</maml:description>
669-
<dev:version>0.4.5</dev:version>
669+
<dev:version>0.4.6</dev:version>
670670
</command:details>
671671
<maml:description>
672672
<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>
@@ -792,7 +792,7 @@ If not provided, this will be the order they are defined in the formatter.</maml
792792
<maml:description>
793793
<maml:para>Gets a Script's story</maml:para>
794794
</maml:description>
795-
<dev:version>0.4.5</dev:version>
795+
<dev:version>0.4.6</dev:version>
796796
</command:details>
797797
<maml:description>
798798
<maml:para>Gets the Script's "Story"</maml:para>
@@ -955,7 +955,7 @@ If not provided, this will be the order they are defined in the formatter.</maml
955955
<maml:description>
956956
<maml:para>Installs MAML into a module</maml:para>
957957
</maml:description>
958-
<dev:version>0.4.5</dev:version>
958+
<dev:version>0.4.6</dev:version>
959959
</command:details>
960960
<maml:description>
961961
<maml:para>Installs MAML into a module. </maml:para>
@@ -1309,7 +1309,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
13091309
<maml:description>
13101310
<maml:para>Determines the percentage of documentation</maml:para>
13111311
</maml:description>
1312-
<dev:version>0.4.5</dev:version>
1312+
<dev:version>0.4.6</dev:version>
13131313
</command:details>
13141314
<maml:description>
13151315
<maml:para>Determines the percentage of documentation in a given script</maml:para>
@@ -1452,7 +1452,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
14521452
<maml:description>
14531453
<maml:para>Saves a Module's MAML</maml:para>
14541454
</maml:description>
1455-
<dev:version>0.4.5</dev:version>
1455+
<dev:version>0.4.6</dev:version>
14561456
</command:details>
14571457
<maml:description>
14581458
<maml:para>Generates a Module's MAML file, and then saves it to the appropriate location.</maml:para>
@@ -1713,7 +1713,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
17131713
<maml:description>
17141714
<maml:para>Saves a Module's Markdown Help</maml:para>
17151715
</maml:description>
1716-
<dev:version>0.4.5</dev:version>
1716+
<dev:version>0.4.6</dev:version>
17171717
</command:details>
17181718
<maml:description>
17191719
<maml:para>Get markdown help for each command in a module and saves it to the appropriate location.</maml:para>

HelpOut.SaveMarkdownHelp.ExtendedTypes.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ foreach ($extendedType in $extendedTypeNames) {
5858
$ExecutionContext.SessionState.PSVariable.Set("function:$($temporaryFunctionName)", $member.$PotentialProperty)
5959
# Then Get-MarkdownHelp,
6060
$markdownHelp = Get-MarkdownHelp -Name $temporaryFunctionName @getMarkdownHelpSplatBase @markdownSplat
61+
if ($markdownHelp -is [string]) {
62+
$ExecutionContext.SessionState.PSVariable.Remove("function:$($temporaryFunctionName)")
63+
continue
64+
}
6165
$markdownHelp.HideSection("Syntax")
6266
# .Save it,
6367
$markdownHelp.Save((Join-Path $outputPath "$($temporaryFunctionName).md"))

HelpOut.psd1

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,20 @@
77
ModuleToProcess='HelpOut.psm1'
88
FormatsToProcess='HelpOut.format.ps1xml'
99
TypesToProcess='HelpOut.types.ps1xml'
10-
ModuleVersion='0.4.5'
10+
ModuleVersion='0.4.6'
1111
PrivateData = @{
1212
PSData = @{
1313
ProjectURI = 'https://github.com/StartAutomating/HelpOut'
1414
LicenseURI = 'https://github.com/StartAutomating/HelpOut/blob/master/LICENSE'
1515

1616
Tags = 'Markdown', 'Help','PowerShell'
1717
ReleaseNotes = @'
18-
### HelpOut 0.4.5:
18+
### HelpOut 0.4.6:
1919
20-
* You can now sponsor HelpOut (#126)
21-
* Added ScriptMethods to PowerShell.Markdown.Help (#125)
22-
* Now allowing Save-MarkDownHelp to be extended by any HelpOut.SaveMarkdownHelp file or function (#123)
23-
* This is used in HelpOut.SaveMarkdownHelp.ExtendedTypes, which auto documents extended types (#101)
20+
* Save-MarkdownHelp: Improving resiliency (Fixes #128)
2421
2522
---
26-
27-
Additional Changes in [ChangeLog](/CHANGELOG.md)
23+
Additional Changes in [Changelog](/CHANGELOG.md)
2824
'@
2925
}
3026
}

Save-MarkdownHelp.ps1

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,13 @@
225225
# otherwise, pass down the parent of $OutputPath.
226226
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}
227227

228+
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
229+
$markdownFile =
230+
if ($markdownTopic.Save) {
231+
$markdownTopic.Save($docOutputPath)
232+
} else { $null }
228233

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

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

266271
try {
267-
$markdownFile = (Get-MarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
272+
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
273+
$markdownFile =
274+
if ($markdownTopic.Save) {
275+
$markdownTopic.Save($docOutputPath)
276+
} else { $null }
268277
}
269278
catch {
270279
$ex = $_
@@ -329,8 +338,12 @@
329338
if ($Wiki) { $getMarkdownHelpSplat.Wiki = $Wiki}
330339
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}
331340
# Call Get-MarkdownHelp, .Save it, and
332-
$markdownFile = (& $GetMarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
333-
341+
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
342+
$markdownFile =
343+
if ($markdownTopic.Save) {
344+
$markdownTopic.Save($docOutputPath)
345+
} else { $null }
346+
334347
$filesChanged += $markdownFile # add the file to the changed list.
335348

336349
# If -PassThru was provided (and we're not going to change anything)

allcommands.ps1

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,13 @@ function Save-MarkdownHelp
16361636
# otherwise, pass down the parent of $OutputPath.
16371637
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}
16381638

1639+
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
1640+
$markdownFile =
1641+
if ($markdownTopic.Save) {
1642+
$markdownTopic.Save($docOutputPath)
1643+
} else { $null }
16391644

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

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

16771682
try {
1678-
$markdownFile = (Get-MarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
1683+
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
1684+
$markdownFile =
1685+
if ($markdownTopic.Save) {
1686+
$markdownTopic.Save($docOutputPath)
1687+
} else { $null }
16791688
}
16801689
catch {
16811690
$ex = $_
@@ -1740,8 +1749,12 @@ function Save-MarkdownHelp
17401749
if ($Wiki) { $getMarkdownHelpSplat.Wiki = $Wiki}
17411750
else { $getMarkdownHelpSplat.GitHubDocRoot = "$($outputPath|Split-Path -Leaf)"}
17421751
# Call Get-MarkdownHelp, .Save it, and
1743-
$markdownFile = (& $GetMarkdownHelp @getMarkdownHelpSplat).Save($docOutputPath)
1744-
1752+
$markdownTopic = Get-MarkdownHelp @getMarkdownHelpSplat
1753+
$markdownFile =
1754+
if ($markdownTopic.Save) {
1755+
$markdownTopic.Save($docOutputPath)
1756+
} else { $null }
1757+
17451758
$filesChanged += $markdownFile # add the file to the changed list.
17461759

17471760
# If -PassThru was provided (and we're not going to change anything)

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### HelpOut 0.4.6:
2+
3+
* Save-MarkdownHelp: Improving resiliency (Fixes #128)
4+
5+
---
6+
17
### HelpOut 0.4.5:
28

39
* You can now sponsor HelpOut (#126)

0 commit comments

Comments
 (0)