Added comment-based help

This commit is contained in:
Markus Fleschutz
2020-12-29 14:14:21 +00:00
parent 3b83d94809
commit 66bc6a7699
85 changed files with 687 additions and 725 deletions

View File

@ -1,23 +1,23 @@
#!/snap/bin/powershell
<#
.SYNTAX ./write-typewriter.ps1 [<text>] [<speed>]
.DESCRIPTION writes the given text with the typewriter effect
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
# Syntax: ./write-typewriter.ps1 [<text>]
# Description: writes the given test with the typewriter effect
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
param([string]$Text = "", [int]$Speed = 250) # in milliseconds
param([string]$Text)
if ($Text -eq "" ) {
$Text = "`nHello World`n-----------`nPowerShell is cross-platform`nPowerShell is open-source`nPowerShell is easy to learn`nPowerShell is fully documented`n`nThanks for watching`n`n:-)`n`n"
}
$Speed = 250 # milliseconds
try {
$Random = New-Object System.Random
$Text -split '' | ForEach-Object {
Write-Host -nonewline $_
Start-Sleep -milliseconds $(1 + $Random.Next($Speed))
write-host -nonewline $_
start-sleep -milliseconds $(1 + $Random.Next($Speed))
}
exit 0
} catch {