Skip to content

Commit 2a544b8

Browse files
it-praktykvors
authored andcommitted
Add the parameter ShowProgress for the New-ExternalHelp function (#360)
* Add the parameter ShowProgress for the New-ExternalHelp function * Correct markdown help for the New-ExternalHelp
1 parent a7b2363 commit 2a544b8

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ CHANGELOG
33

44
## Not released
55

6+
* The ShowProgress parameter was added to the New-ExternalHelp function. By default progress bars are not display to increase speed of files processing.
7+
68
## 0.9.0
79

810
* platyPS is now cross platform and works on powershell 6.0 as well as previous versions of powershell.

docs/New-ExternalHelp.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Creates external help file based on markdown supported by PlatyPS.
1414

1515
```
1616
New-ExternalHelp -Path <String[]> -OutputPath <String> [-ApplicableTag <String[]>] [-Encoding <Encoding>]
17-
[-MaxAboutWidth <Int32>] [-ErrorLogFile <String>] [-Force] [<CommonParameters>]
17+
[-MaxAboutWidth <Int32>] [-ErrorLogFile <String>] [-Force] [-ShowProgress] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -203,6 +203,23 @@ Accept pipeline input: False
203203
Accept wildcard characters: False
204204
```
205205

206+
### -ShowProgress
207+
Display progress bars under parsing existing markdown files.
208+
209+
If this is used generating of help is much slower.
210+
211+
```yaml
212+
Type: SwitchParameter
213+
Parameter Sets: (All)
214+
Aliases:
215+
216+
Required: False
217+
Position: Named
218+
Default value: None
219+
Accept pipeline input: False
220+
Accept wildcard characters: False
221+
```
222+
206223
### CommonParameters
207224
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
208225

src/platyPS/platyPS.psm1

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ $script:MODULE_PAGE_ADDITIONAL_LOCALE = "Additional Locale"
3737

3838
$script:MAML_ONLINE_LINK_DEFAULT_MONIKER = 'Online Version:'
3939

40-
# Write-Progress is not very useful on coreclr
41-
if (Get-Variable -Name IsCoreClr -ValueOnly -ErrorAction SilentlyContinue) {
42-
# silent Write-Progress
43-
function Write-Progress() {}
44-
}
45-
4640
function New-MarkdownHelp
4741
{
4842
[CmdletBinding()]
@@ -762,7 +756,9 @@ function New-ExternalHelp
762756

763757
[string]$ErrorLogFile,
764758

765-
[switch]$Force
759+
[switch]$Force,
760+
761+
[switch]$ShowProgress
766762
)
767763

768764
begin
@@ -782,6 +778,11 @@ function New-ExternalHelp
782778
New-Item -Type Directory $OutputPath -ErrorAction SilentlyContinue > $null
783779
Write-Verbose "[New-ExternalHelp] Use $OutputPath as path to a directory"
784780
}
781+
782+
if ( -not $ShowProgress.IsPresent -or $(Get-Variable -Name IsCoreClr -ValueOnly -ErrorAction SilentlyContinue) )
783+
{
784+
Function Write-Progress() {}
785+
}
785786
}
786787

787788
process

0 commit comments

Comments
 (0)