Created
May 9, 2022 18:31
-
-
Save Bizarrorollins/0e9cd99ce3d24e02b4b8cd0564a33a29 to your computer and use it in GitHub Desktop.
powershell.code-snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Class": { | |
"prefix": "psclass", | |
"body": [ | |
"class ${Name} {", | |
"\t$0", | |
"}" | |
], | |
"description": "Class" | |
}, | |
"ShortHelp": { | |
"prefix": "pshelp", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\t${1:Short description}\n", | |
".DESCRIPTION", | |
"\t${2:Long description}\n", | |
".NOTES", | |
"\t${0:General Notes}\n", | |
"#>" | |
], | |
"description": "Basic help comment block for simple functions" | |
}, | |
"FullHelp": { | |
"prefix": "psscripthelp", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\t${1:'Short description'}\n", | |
".DESCRIPTION", | |
"\t${2:'Long description'}\n", | |
".PARAMETER ${3:ParameterName}", | |
"\t${4:'Description of parameter input'}\n", | |
".EXAMPLE", | |
"\tPS>\n", | |
"\tExample of how to use this cmdlet\n", | |
".EXAMPLE", | |
"\tPS>\n", | |
"\tAnother example of how to use this cmdlet\n", | |
".LINK", | |
"\tAny related function or website\n", | |
".NOTES", | |
"\t${5:'General notes'}", | |
"#>\n\n", | |
"<#PSScriptInfo", | |
".VERSION 1.0.0\n", | |
".AUTHOR ${6:USERNAME}\n", | |
".GUID be7e5b3f-${CURRENT_YEAR}-${CURRENT_MONTH}${CURRENT_DATE}-${CURRENT_HOUR}${CURRENT_MINUTE}-${CURRENT_SECOND}afcca5c65a\n", | |
".TAGS ${7:tags}\n", | |
".ICONURI\n", | |
".EXTERNALMODULEDEPENDENCIES\n", | |
".RELEASENOTES", | |
"\t1.0.0 - Initial Release", | |
"#>\n", | |
"[cmdletbinding()]\n", | |
"param(", | |
"\t[Parameter()]", | |
"\t[PSObject] $${3:ParameterName}", | |
")", | |
"$0" | |
], | |
"description": "Full comment-based help for a new script" | |
}, | |
"Basic function": { | |
"prefix": "psbasicfunction", | |
"body": [ | |
"function ${TM_FILENAME_BASE}($${3:ParameterName}){\n", | |
"\t<#", | |
"\t.SYNOPSIS", | |
"\t\t${1:'Short description'}\n", | |
"\t.DESCRIPTION", | |
"\t\t${2:'Long description'}\n", | |
"\t.NOTES", | |
"\t\t${5:'General notes'}", | |
"\t#>\n", | |
"\t$0", | |
"}" | |
], | |
"description": "Full config for a new advanced function" | |
}, | |
"Advanced Function": { | |
"prefix": "psadvfunction", | |
"body": [ | |
"function ${TM_FILENAME_BASE}{\n", | |
"\t<#", | |
"\t.SYNOPSIS", | |
"\t\t${1:'Short description'}\n", | |
"\t.DESCRIPTION", | |
"\t\t${2:'Long description'}\n", | |
"\t.PARAMETER ${3:ParameterName}", | |
"\t\t${4:'Description of parameter input'}\n", | |
"\t.EXAMPLE", | |
"\t\tPS>\n", | |
"\t\tExample of how to use this cmdlet\n", | |
"\t.EXAMPLE", | |
"\t\tPS>\n", | |
"\t\tAnother example of how to use this cmdlet\n", | |
"\t.INPUTS", | |
"\t\tInputs to this cmdlet (if any)\n", | |
"\t.OUTPUTS", | |
"\t\tOutput from this cmdlet (if any)\n", | |
"\t.LINK", | |
"\t\tAny related function or website\n", | |
"\t.NOTES", | |
"\t\t${5:'General notes'}", | |
"\t#>\n", | |
"\t[cmdletbinding()]\n", | |
"\tparam(", | |
"\t\t[Parameter()]", | |
"\t\t[PSObject] $${3:ParameterName}", | |
"\t)\n", | |
"\tBEGIN{}\n", | |
"\tPROCESS{\n", | |
"\t\t$0", | |
"\t}\n", | |
"\tEND{}", | |
"}" | |
], | |
"description": "Full config for a new advanced function" | |
}, | |
"Pester Tests": { | |
"prefix": "pspester", | |
"body": [ | |
"<#", | |
".SYNOPSIS", | |
"\tPester tests generated for function ${TM_FILENAME_BASE}\n", | |
".DESCRIPTION", | |
"\t${1:'Pester Test Description'}\n", | |
"#>\n", | |
"BeforeAll {\n", | |
"}\n", | |
"Describe ${2:DescribeBlock} {\n", | |
"\tContext ${3:ContextBlock} {\n", | |
"\t\tIt ${4:TestContents} {\n", | |
"\t\t\t$0", | |
"\t\t}", | |
"\t}", | |
"}" | |
], | |
"description": "General setup of a new Pester file" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment