Skip to content

Commit cf9013d

Browse files
geekwhocodesGanesh Raskargeekwhocodes
authored
Release v2 (#70)
* fixed code sign script * fixed build script * more powershelly syntax * powershelly syntax example * Added Register-LoggingProvider cmdlt and examples * Added platyPS modified verison to generate docs for docusaurus * generated module docs * Added V2 commands in comments and fixed clea-buffer * Added PSScriptAnalyzer settings * Added script to generate module docs automatically using platyPS * Update docs for v2 cmdlts * Add Write-SimpleLog cmdlt * Update readme to have v2 syntax * Update docs to have v2 syntax * Update Readme * Added PR template * fixed typo * update example to use v2 * Update tests * Rearrange sections * update usage example * fixed default log level value in message * Version 2 Co-authored-by: Ganesh Raskar <Ganesh.Raskar@RapidCircle.com> Co-authored-by: geekwhocodes <ganesh.raskar@outlook.com>
1 parent c141f01 commit cf9013d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+9626
-115
lines changed

.build/build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (-Not $TempArchiveDir -or $null -eq $TempArchiveDir) {
1414
Write-Information "Creating stagged archive at $TempArchiveDir" -InformationAction Continue
1515
Copy-Item -Path "$pwd\SimplePSLogger" -Destination $TempArchiveDir -Recurse -Force
1616
Write-Information "Creating stagged archive at $TempArchiveDir" -InformationAction Continue
17-
17+
<#>
1818
$FilesToWrite = Get-ChildItem -Path $TempArchiveDir -Recurse -ErrorAction Stop | Where-Object { $_.Extension -in ".psd1", ".psm1", ".ps1" } | Select-Object -ExpandProperty FullName
1919
2020
#Remove existing signature
@@ -40,5 +40,5 @@ $FilesToWrite | ForEach-Object {
4040
Write-Error -Message $_.Exception.Message
4141
}
4242
}
43-
43+
#>
4444
return $TempArchiveDir

.build/code-sign.ps1

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,10 @@ if (-not @($FilesToSign)) {
3636
return "All files are already signed. yay!"
3737
}
3838

39-
$results = $FilesToSign | ForEach-Object {
39+
$FilesToSign | ForEach-Object {
4040
$Signed = Set-AuthenticodeSignature $_ -Certificate $cert -TimestampServer 'http://timestamp.digicert.com' -ErrorAction Stop
4141
$Signed | Out-String | Write-Output
42-
$Signed
43-
}
44-
45-
$failed = $results | Where-Object { $_.Status -ne "Valid" }
46-
47-
if ($failed) {
48-
throw "Failed to sign - $($failed.Path)"
42+
if ($Signed.Status -ne "Valid") {
43+
Write-Error "Failed to sign $($Signed.Path) file" -ErrorAction Continue
44+
}
4945
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
external help file: platyPS-help.xml
3+
Module Name: platyPS
4+
online version: https://github.com/PowerShell/platyPS/blob/master/docs/Get-HelpPreview.md
5+
schema: 2.0.0
6+
---
7+
8+
# Get-HelpPreview
9+
10+
## SYNOPSIS
11+
Displays your generated external help as **Get-Help** output.
12+
13+
## SYNTAX
14+
15+
```
16+
Get-HelpPreview -Path <String[]> [-ConvertNotesToList] [-ConvertDoubleDashLists] [<CommonParameters>]
17+
```
18+
19+
## DESCRIPTION
20+
The **Get-HelpPreview** cmdlet displays your generated external help as **Get-Help** output.
21+
Specify one or more files in Microsoft Assistance Markup Language (MAML) format.
22+
23+
## EXAMPLES
24+
25+
### Example 1: Preview the PlatyPS help
26+
```
27+
PS C:\> $Help = Get-HelpPreview -Path ".\out\platyPS\en-US\PlatyPS-help.xml"
28+
29+
PS C:\> $Help.Name
30+
31+
Get-HelpPreview
32+
Get-MarkdownMetadata
33+
New-ExternalHelp
34+
New-ExternalHelpCab
35+
New-MarkdownHelp
36+
Update-MarkdownHelp
37+
Update-MarkdownHelpModule
38+
Update-MarkdownHelpSchema
39+
```
40+
41+
The first command creates a **Help** object for the the specified MAML file.
42+
The command stores it in the $Help variable.
43+
44+
The second command displays the **Name** property for each of the objects in $Help.
45+
46+
## PARAMETERS
47+
48+
### -Path
49+
Specifies an array of paths of MAML external help files.
50+
51+
```yaml
52+
Type: String[]
53+
Parameter Sets: (All)
54+
Aliases:
55+
56+
Required: True
57+
Position: Named
58+
Default value: None
59+
Accept pipeline input: True (ByValue)
60+
Accept wildcard characters: True
61+
```
62+
63+
### -ConvertNotesToList
64+
Indicates that this cmldet formats multiple paragraph items in the **NOTES** section as single list items.
65+
This output follows TechNet formatting.
66+
67+
```yaml
68+
Type: SwitchParameter
69+
Parameter Sets: (All)
70+
Aliases:
71+
72+
Required: False
73+
Position: Named
74+
Default value: None
75+
Accept pipeline input: False
76+
Accept wildcard characters: False
77+
```
78+
79+
### -ConvertDoubleDashLists
80+
Indicates that this cmldet converts double-hyphen list bullets into single-hyphen bullets.
81+
Double-hyphen lists are common in Windows PowerShell documentation.
82+
Markdown accepts single-hyphens for lists.
83+
84+
```yaml
85+
Type: SwitchParameter
86+
Parameter Sets: (All)
87+
Aliases:
88+
89+
Required: False
90+
Position: Named
91+
Default value: None
92+
Accept pipeline input: False
93+
Accept wildcard characters: False
94+
```
95+
96+
### CommonParameters
97+
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).
98+
99+
## INPUTS
100+
101+
### String[]
102+
You can pipe an array of paths to this cmdlet.
103+
104+
## OUTPUTS
105+
106+
### Help Object
107+
This cmdlet returns a **Help** object, which is the same output as **Get-Help**.
108+
109+
## NOTES
110+
111+
## RELATED LINKS
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
external help file: platyPS-help.xml
3+
Module Name: platyPS
4+
online version: https://github.com/PowerShell/platyPS/blob/master/docs/Get-MarkdownMetadata.md
5+
schema: 2.0.0
6+
---
7+
8+
# Get-MarkdownMetadata
9+
10+
## SYNOPSIS
11+
Gets metadata from the header of a markdown file.
12+
13+
## SYNTAX
14+
15+
### FromPath (Default)
16+
```
17+
Get-MarkdownMetadata -Path <String[]> [<CommonParameters>]
18+
```
19+
20+
### FromMarkdownString
21+
```
22+
Get-MarkdownMetadata -Markdown <String> [<CommonParameters>]
23+
```
24+
25+
## DESCRIPTION
26+
The **Get-MarkdownMetadata** cmdlet gets the metadata from the header of a markdown file that is supported by PlatyPS.
27+
The command returns the metadata as a hash table.
28+
29+
PlatyPS stores metadata in the header block of a markdown file as key-value pairs of strings.
30+
By default, PlatyPS stores help file name and markdown schema version.
31+
32+
Metadata section can contain user-provided values for use with external tools.
33+
The [New-ExternalHelp](New-ExternalHelp.md) cmdlet ignores this metadata.
34+
35+
## EXAMPLES
36+
37+
### Example 1: Get metadata from a file
38+
```
39+
PS C:\> Get-MarkdownMetadata -Path ".\docs\Get-MarkdownMetadata.md"
40+
41+
Key Value
42+
--- -----
43+
external help file platyPS-help.xml
44+
schema 2.0.0
45+
```
46+
47+
This command retrieves metadata from a markdown file.
48+
49+
### Example 2: Get metadata from a markdown string
50+
```
51+
PS C:\> $Markdown = Get-Content -Path ".\docs\Get-MarkdownMetadata.md" -Raw
52+
PS C:\> Get-MarkdownMetadata -Markdown $Markdown
53+
54+
Key Value
55+
--- -----
56+
external help file platyPS-help.xml
57+
schema 2.0.0
58+
```
59+
60+
The first command gets the contents of a file, and stores them in the $Markdown variable.
61+
62+
The second command retrieves metadata from the string in $Metadata.
63+
64+
### Example 3: Get metadata from all files in a folder
65+
```
66+
PS C:\> Get-MarkdownMetadata -Path ".\docs"
67+
68+
Key Value
69+
--- -----
70+
external help file platyPS-help.xml
71+
schema 2.0.0
72+
external help file platyPS-help.xml
73+
schema 2.0.0
74+
external help file platyPS-help.xml
75+
schema 2.0.0
76+
external help file platyPS-help.xml
77+
schema 2.0.0
78+
external help file platyPS-help.xml
79+
schema 2.0.0
80+
external help file platyPS-help.xml
81+
schema 2.0.0
82+
external help file platyPS-help.xml
83+
schema 2.0.0
84+
external help file platyPS-help.xml
85+
schema 2.0.0
86+
```
87+
88+
This command gets metadata from each of the markdown files in the .\docs folder.
89+
90+
## PARAMETERS
91+
92+
### -Path
93+
Specifies an array of paths of markdown files or folders.
94+
95+
```yaml
96+
Type: String[]
97+
Parameter Sets: FromPath
98+
Aliases:
99+
100+
Required: True
101+
Position: Named
102+
Default value: None
103+
Accept pipeline input: True (ByPropertyName, ByValue)
104+
Accept wildcard characters: True
105+
```
106+
107+
### -Markdown
108+
Specifies a string that contains markdown formatted text.
109+
110+
```yaml
111+
Type: String
112+
Parameter Sets: FromMarkdownString
113+
Aliases:
114+
115+
Required: True
116+
Position: Named
117+
Default value: None
118+
Accept pipeline input: False
119+
Accept wildcard characters: False
120+
```
121+
122+
### CommonParameters
123+
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).
124+
125+
## INPUTS
126+
127+
### String[]
128+
You can pipe an array of paths to this cmdlet.
129+
130+
## OUTPUTS
131+
132+
### Dictionary[String, String]
133+
The cmdlet returns a **Dictionary\[String, String\]** object.
134+
The dictionary contains key-value pairs found in the markdown metadata block.
135+
136+
## NOTES
137+
138+
## RELATED LINKS

0 commit comments

Comments
 (0)