Last active
November 9, 2020 11:45
-
-
Save cwchentw/657ff4d28291336dc05a9b5a8335878c to your computer and use it in GitHub Desktop.
Yet Another PowerShell Profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Yet Another PowerShell profile | |
# | |
# Copyright (c) 2020. Michael Chen. Licensed under Apache 2.0. | |
# Tested against PowerShell 7. | |
# Show the version of PowerShell. | |
function Version { | |
Get-Host | Select-Object Version | |
} | |
# Generate a sitemap.xml by crawling a website. | |
function Sitemap { | |
Get-Command npx 1>$null 2>$null | |
if ($?) { | |
npx sitemap-generator-cli $args | |
} | |
else { | |
Write-Error "No Node.js on the System" | |
} | |
} | |
# Home-made assertion. | |
function Assert { | |
param ($condition, $message) | |
if (-not ($condition)) { | |
throw $message | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment