src/Cmdlets/New-Blog.psm1
|
using namespace System.Text using module ../Blog.psm1 <# .SYNOPSIS Creates a new blog. .OUTPUTS The newly created blog. #> function New-Blog { [CmdletBinding()] [OutputType([Blog])] param ( # The blog or site URL. [Parameter(Mandatory, Position = 0)] [uri] $Url, # The character encoding for the values included in comments. [ValidateScript({ $charset = $_ [string]::IsNullOrEmpty($charset) -or [Encoding].GetEncodings().Where({ $_.Name -eq $charset }, "First").Count }, ErrorMessage = "The specified character encoding is unknown.")] [string] $Charset, # The languages in use on the blog or site, in ISO 639-1 format. [ValidateNotNull()] [string[]] $Languages = @() ) $blog = [Blog] $Url $blog.Charset = $Charset ? [Encoding]::GetEncoding($Charset) : $null $blog.Languages = $Languages $blog } |