Skip to content

Brownserve.PSCommon Module

Description

TBD

Brownserve.PSCommon Cmdlets

Assert-Command

Ensures the given command exists and is available to the current PowerShell session

Assert-Directory

Ensures that a directory is valid

Assert-Path

Ensures a given path exists.

ConvertTo-BlockComment

Converts a given text string into a block comment

ConvertTo-SortedHashtable

Converts a given hashtable to an alphabetically sorted hashtable

Format-BrownserveContent

Formats a given string to be compatible with the various *-BrownserveContent cmdlets.

Format-Markdown

Formats a markdown file to ensure it follows the markdownlint rules.

Get-BrownserveContent

Wrapper for Get-Content that returns the content in a format that is easier to work with.

Get-Response

Prompts a user for a response.

Install-ChocolateyPackage

Helper cmdlet for installing Chocolatey packages programmatically

Invoke-ConvertFromYaml

Wrapper cmdlet for ConvertFrom-Yaml

Invoke-ConvertToYaml

Wrapper cmdlet for ConvertTo-YAML

Invoke-DownloadMethod

Downloads a file using the best method available depending on operating system.

Invoke-NativeCommand

Invokes a native command while gracefully handling the output and error streams.

Merge-Hashtable

Merges two hashtables together

New-BrownserveContentFromTemplate

Generates content from a template file, optionally substituting placeholder values.

New-BrownserveTemporaryDirectory

Creates a temporary directory

New-BrownserveTemporaryFile

Creates a temporary file in a known good location.

Read-ConfigurationFromFile

Reads values from a configuration file

Remove-Markdown

This cmdlet removes markdown from a string.

Select-BrownserveContent

Selects text from a given file

Set-BrownserveContent

Writes the contents of a file to disk.

Set-LineEndings

Sets the line endings of a file to either CRLF or LF

Split-URI

Takes a given URI and splits it into its constituent parts.

Test-Administrator

A simple function for testing if a user is running with administrator/root privileges or not.

Test-Numeric

Tests if a given object is numeric.

Test-OperatingSystem

Quick way of terminating scripts when they are running on an incompatible OS.