Update export-scripts2manuals.ps1

This commit is contained in:
Markus Fleschutz 2021-10-10 09:24:31 +02:00
parent c7c8264551
commit cd3fe1fe12
13 changed files with 101 additions and 31 deletions

View File

@ -0,0 +1,33 @@
## export-scripts2manuals.ps1 - Generates manuals from the scripts
This script exports the comment based help of all scripts to the manuals.
## Parameters
```powershell
export-scripts2manuals.ps1 [[-FilePattern] <String>] [<CommonParameters>]
-FilePattern <String>
Required? false
Position? 1
Default value "$PSScriptRoot/*.ps1"
Accept pipeline input? false
Accept wildcard characters? false
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
## Example
```powershell
PS>./export-scripts2manuals.ps1
```
## Notes
Author: Markus Fleschutz · License: CC0
## Related Links
https://github.com/fleschutz/PowerShell
*Generated by convert-ps2md.ps1 using the comment-based help of export-scripts2manuals.ps1*

View File

@ -0,0 +1,29 @@
## export-scripts2serenade.ps1 - ← enter overview of script here
← enter brief description of script here
## Parameters
```powershell
export-scripts2serenade.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
## Inputs
← enter inputs here (if any, otherwise state None)
## Example
```powershell
PS>.\template.ps1 ← enter example here (repeat this attribute for more than one example)
```
## Notes
Author: ← enter full name here
License: ← enter license here
## Related Links
← enter URL here
*Generated by convert-ps2md.ps1 using the comment-based help of export-scripts2serenade.ps1*

View File

@ -1,4 +1,4 @@
## list-network-shares.ps1 - Lists the network shares of the local computer ## list-network-shares.ps1 - Lists all network shares of the local computer
list-network-shares.ps1 list-network-shares.ps1

View File

@ -1,6 +1,6 @@
## list-voices.ps1 - Lists the installed text-to-speech (TTS) voices ## list-voices.ps1 - Lists the installed text-to-speech voices
list-voices.ps1 This script lists the installed text-to-speech voices. It requires PowerShell 2.0 or higher.
## Parameters ## Parameters
```powershell ```powershell

View File

@ -1,6 +1,6 @@
## mute-audio.ps1 - Mutes the audio output ## mute-audio.ps1 - Mutes the audio output
mute-audio.ps1 This script mutes the default audio device immediately.
## Parameters ## Parameters
```powershell ```powershell

View File

@ -1,6 +1,6 @@
## play-beep.ps1 - Plays a short beep sound ## play-beep.ps1 - Plays a beep sound
play-beep.ps1 This script plays a short beep sound.
## Parameters ## Parameters
```powershell ```powershell

View File

@ -1,6 +1,6 @@
## play-happy-birthday.ps1 - Plays the Happy Birthday song ## play-happy-birthday.ps1 - Plays the Happy Birthday song
play-happy-birthday.ps1 This script plays the well-known Happy Birthday song.
## Parameters ## Parameters
```powershell ```powershell
@ -14,6 +14,7 @@ play-happy-birthday.ps1 [<CommonParameters>]
## Example ## Example
```powershell ```powershell
PS>./play-happy-birthday PS>./play-happy-birthday
(listen and enjoy)
``` ```
## Notes ## Notes

View File

@ -1,6 +1,6 @@
## play-imperial-march.ps1 - Plays the Imperial March (Star Wars) ## play-imperial-march.ps1 - Plays the Imperial March (Star Wars)
play-imperial-march.ps1 This script plays the Imperial March used in the Star Wars film series.
## Parameters ## Parameters
```powershell ```powershell
@ -14,6 +14,7 @@ play-imperial-march.ps1 [<CommonParameters>]
## Example ## Example
```powershell ```powershell
PS>./play-imperial-march PS>./play-imperial-march
(listen and enjoy)
``` ```
## Notes ## Notes

View File

@ -1,6 +1,6 @@
## speak-joke.ps1 - Speaks a random Chuck Norris joke by text-to-speech (TTS) ## speak-joke.ps1 - Speaks a random Chuck Norris joke by text-to-speech
speak-joke.ps1 This script selects a random joke in Data/jokes.csv and uses text-to-speech (TTS) for output.
## Parameters ## Parameters
```powershell ```powershell
@ -14,6 +14,7 @@ speak-joke.ps1 [<CommonParameters>]
## Example ## Example
```powershell ```powershell
PS>./speak-joke PS>./speak-joke
(listen and have fun)
``` ```
## Notes ## Notes

View File

@ -1,6 +1,6 @@
## speak-quote.ps1 - Speaks a random quote by text-to-speech (TTS) ## speak-quote.ps1 - Speaks a random quote by text-to-speech
speak-quote.ps1 This script selects a random quote in Data/quotes.csv and uses text-to-speech (TTS) for output.
## Parameters ## Parameters
```powershell ```powershell
@ -14,6 +14,7 @@ speak-quote.ps1 [<CommonParameters>]
## Example ## Example
```powershell ```powershell
PS>./speak-quote PS>./speak-quote
(listen and learn)
``` ```
## Notes ## Notes

View File

@ -1,13 +1,13 @@
## wakeup.ps1 - Sends a magic packet to a computer to wake him up ## wakeup.ps1 - Sends a magic packet to a computer to wake him up
Sends a magic packet to a computer to wake him up (requires Wake-On-LAN) Sends a magic UDP packet twice to a computer to wake him up (requires Wake-On-LAN).
wakeup.ps1 [<MAC-address>] [<IP-address>]
## Parameters ## Parameters
```powershell ```powershell
wakeup.ps1 [[-MACaddress] <String>] [[-IPaddress] <String>] [[-Port] <Int32>] [<CommonParameters>] wakeup.ps1 [[-MACaddress] <String>] [[-IPaddress] <String>] [[-Port] <Int32>] [<CommonParameters>]
-MACaddress <String> -MACaddress <String>
Specifies the host's MAC address (e.g. 11:22:33:44:55:66)
Required? false Required? false
Position? 1 Position? 1
@ -16,6 +16,7 @@ wakeup.ps1 [[-MACaddress] <String>] [[-IPaddress] <String>] [[-Port] <Int32>] [<
Accept wildcard characters? false Accept wildcard characters? false
-IPaddress <String> -IPaddress <String>
Specifies the host's IP address or subnet address (e.g. 255.255.255.255)
Required? false Required? false
Position? 2 Position? 2
@ -24,6 +25,7 @@ wakeup.ps1 [[-MACaddress] <String>] [[-IPaddress] <String>] [[-Port] <Int32>] [<
Accept wildcard characters? false Accept wildcard characters? false
-Port <Int32> -Port <Int32>
Specifies the UDP port (9 by default)
Required? false Required? false
Position? 3 Position? 3
@ -39,6 +41,7 @@ wakeup.ps1 [[-MACaddress] <String>] [[-IPaddress] <String>] [[-Port] <Int32>] [<
## Example ## Example
```powershell ```powershell
PS>./wakeup 11:22:33:44:55:66 192.168.100.100 PS>./wakeup 11:22:33:44:55:66 192.168.100.100
(PC wakes up)
``` ```
## Notes ## Notes

View File

@ -70,7 +70,7 @@ try {
"## Parameters" "## Parameters"
"``````powershell" "``````powershell"
$Syntax = (($full.syntax | Out-String) -replace "`r`n", "`r`n").Trim() $Syntax = (($full.syntax | Out-String) -replace "`r`n", "`r`n").Trim()
$Syntax = (($Syntax | Out-String) -replace "/home/markus/Repos/PowerShell/Scripts/", "") $Syntax = (($Syntax | Out-String) -replace "/home/mf/PowerShell/Scripts/", "")
if ($Syntax -ne "") { if ($Syntax -ne "") {
"$Syntax" "$Syntax"
} }

View File

@ -1,31 +1,32 @@
<# <#
.SYNOPSIS .SYNOPSIS
enter overview of script here Generates manuals from the scripts
.DESCRIPTION .DESCRIPTION
enter brief description of script here This script exports the comment based help of all scripts to the manuals.
.INPUTS
enter inputs here (if any, otherwise state None)
.OUTPUTS
enter outputs here (if any, otherwise state None)
.EXAMPLE .EXAMPLE
PS> .\template.ps1 enter example here (repeat this attribute for more than one example) PS> ./export-scripts2manuals.ps1
.NOTES .NOTES
Author: enter full name here Author: Markus Fleschutz · License: CC0
License: enter license here
.LINK .LINK
enter URL here https://github.com/fleschutz/PowerShell
#> #>
#requires -version 4 #requires -version 2
param() # ← enter script parameters here param([string]$FilePattern = "$PSScriptRoot/*.ps1")
# ← enter functions here
try { try {
# ← enter instructions here $StopWatch = [system.diagnostics.stopwatch]::startNew()
"✔️ Done." $Scripts = Get-ChildItem "$FilePattern"
"Found $($Scripts.Count) scripts, starting export..."
foreach ($Script in $Scripts) {
& "$PSScriptRoot/convert-ps2md" "$Script" > "$PSScriptRoot/../Docs/$($Script.BaseName).md"
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ exported $($Scripts.Count) scripts to manuals in $Elapsed sec"
exit 0 exit 0
} catch { } catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"