Skip to content

Instantly share code, notes, and snippets.

View Find-PagerEnvVars.ps1
function Find-PagerEnvVars {
<#
.synopsis
find common pager related vars
#>
ls env: | ? Key -match 'less|pager|bat|wsl|term|local'
}
function viewHelpPager {
<#
@ninmonkey
ninmonkey / Powershell Documentation Examples.readme.md
Last active Nov 30, 2021
Powershell Documentation Examples.md
View Powershell Documentation Examples.readme.md
@ninmonkey
ninmonkey / snippets-powershell.json
Last active Oct 23, 2021
Pester5 Foreach-Loop snippet.json
View snippets-powershell.json
{
// to use snippets, see: https://code.visualstudio.com/docs/editor/userdefinedsnippets
// The monkey makes it easier to find in menus
"Pester ⇢ ForEach Data 🐒": {
"prefix": "pestForEach 🐒 Test Data",
"body": [
"It '\"<${1:Name}>\" Returns \"<expected>\"' -ForEach @(",
" @{ ${1:Name} = ${2:x} ; Expected = ${3:y} }",
") {",
" ${0:YourFunction} -${1:Name} \\$${1:Name} | Should -Be \\$Expected",
@ninmonkey
ninmonkey / PSScriptAnalyzer.tests.ps1
Last active Oct 23, 2021
Indented rules indented-automation/Indented.ScriptAnalyzerRules
View PSScriptAnalyzer.tests.ps1
# Style guide: https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines?view=powershell-7.1
# used with: https://github.com/indented-automation/Indented.ScriptAnalyzerRules
# source: https://discord.com/channels/180528040881815552/447476117629304853/869991142001872946
Describe PSScriptAnalyzer {
BeforeDiscovery {
$moduleRoot = $PSScriptRoot.Substring(0, $PSScriptRoot.IndexOf('\tests'))
$projectRoot = $moduleRoot | Split-Path -Parent
$settings = Join-Path $projectRoot -ChildPath 'PSScriptAnalyzerSettings.psd1'