The License for Turtle
View Source
<#
.SYNOPSIS
Project License
.DESCRIPTION
The License for the project
.NOTES
The License for the project
#>
param(
# We can provide the repository url by hard-coding it,
# or it can be provided in site or page metadata.
# If we do not provide either, we can also look at the `$gitHubEvent`
[uri]
$RepositoryUrl,
# We can provide the changelog path by hard-coding it, or it can provided in site or page metadata.
[string]
$LicensePath = '../LICENSE'
)
# Push into this location, in case we are building this file interactively.
if ($PSScriptRoot) { Push-Location $PSScriptRoot}
if (-not $RepositoryUrl) {
if ($gitHubEvent.repository.html_url) {
$repositoryUrl = $gitHubEvent.repository.html_url -as [uri]
} else {
return
}
}
# Get my own help
$myHelp = Get-Help $MyInvocation.MyCommand.ScriptBlock.File
if ($myHelp) {
# If we have page metadata
if ($page -is [Collections.IDictionary]) {
# Replace 'Project' in the title with the url, to make the title and description more helpful
$page.Title = $myHelp.SYNOPSIS -replace 'Project', {
$RepositoryUrl.Segments[-1] -replace '/'
}
$page.Description = $myHelp.Description.text -join [Environment]::NewLine -replace 'The Project', {
$RepositoryUrl.Segments[-1] -replace '/'
}
}
# If we have notes, replace the project with our name
$myNotes = $myHelp.alertSet.alert.text -join [Environment]::NewLine -replace 'The Project', {
$RepositoryUrl.Segments[-1] -replace '/'
}
if ($myNotes) {
# and convert our notes from markdown.
(ConvertFrom-Markdown -InputObject $myNotes).Html
}
}
# Break up the space a bit with horizontal rules.
"<hr/>"
# Display source for this page
"<details>"
"<summary>View Source</summary>"
"<pre>"
"<code class='language-PowerShell'>"
[Web.HttpUtility]::HtmlEncode($MyInvocation.MyCommand.ScriptBlock)
"</code>"
"</pre>"
"</details>"
# Break up the space a bit with horizontal rules.
"<hr/>"
# Get our license
"<pre class='license'>"
[Web.HttpUtility]::HtmlEncode(
(Get-ChildItem -Path $LicensePath | Get-Content -Raw)
)
"</pre>"
# If we pushed into the location, pop back out.
if ($PSScriptRoot) { Pop-Location}
# We're done!
MIT License Copyright (c) 2025 PowerShellWeb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.