Skip to content

Instantly share code, notes, and snippets.

@cwchentw
Last active November 9, 2020 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwchentw/657ff4d28291336dc05a9b5a8335878c to your computer and use it in GitHub Desktop.
Save cwchentw/657ff4d28291336dc05a9b5a8335878c to your computer and use it in GitHub Desktop.
Yet Another PowerShell Profile
# 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