diff --git a/snippets/language-powershell.cson b/snippets/language-powershell.cson index 934fc2b..f162945 100644 --- a/snippets/language-powershell.cson +++ b/snippets/language-powershell.cson @@ -25,7 +25,10 @@ 'body': '.SYNOPSIS\n' 'Function Cmdlet': 'prefix': 'func' - 'body': '<#\n.SYNOPSIS\n\tShort description\n\n.DESCRIPTION\n\tLong description\n\n.OUTPUTS\n\tThe value returned by this cmdlet\n\n.EXAMPLE\n\tExample of how to use this cmdlet\n\n.LINK\n\tTo other relevant cmdlets or help\n#>\nFunction ${1:Verb}-${2:Noun}\n{\n\t[CmdletBinding()]\n\t[OutputType([Nullable])]\n\tParam\n\t(\n\t\t# Param1 help description\n\t\t[Parameter(Mandatory, ValueFromPipelineByPropertyName, Position=0)]\n\t\t\$Param1,\n\n\t\t# Param2 help description\n\t\t[int]\n\t\t\$Param2\n\t)\n\tBegin\n\t{\n\t\t${3:# code}\n\t}\n\tProcess\n\t{\n\t}\n\tEnd\n\t{\n\t}\n}' + 'body': 'Function ${1:Verb}-${2:Noun} {\n\n<#\n.SYNOPSIS\n\tA brief description of the function or script.\n\n.DESCRIPTION\n\tA detaild description of the function or script.\n\n.PARAMETER Param1\n\tThe description of a parameter. Add a .PARAMETER keyword for each parameter in the function or script syntax.\n\n.PARAMETER Param2\n\tThe description of a parameter.\n\n.INPUTS\n\tThe object input type/s accepted by this cmdlet\n\t(EX: [System.String],[System.Int32])\n\n.OUTPUTS\n\tThe object output type returned by this cmdlet\n\n.EXAMPLE\n\tExample of how to use this cmdlet\n\n.NOTES\n\tAdditional information about the function or script.\n\n.LINK\n\tabout_functions_advanced\n\n.LINK\n\tabout_comment_based_help\n\n.LINK\n\tabout_functions_advanced_parameters\n#>\n\n\t[CmdletBinding()]\n\t[OutputType([System.Nullable])]\n\tParam\n\t(\n\t\t[Parameter(Position=0, Mandatory=$true)]\n\t\t\[System.String]$Param1,\n\n\t\t[Parameter(Position=1, Mandatory=$false)]\n\t\t[System.Int32]$Param2\n\t)\n\n\tBEGIN {\n\n\t\t # run this code to setup environment\n\n\t} # end BEGIN block\n\n\tPROCESS {\n\n\t\t # production code\n\n\t} # end PROCESS block\n\n\tEND {\n\n\t\t # cleanup code\n\n\t} # end END block\n\n} # end function Verb-Noun' + 'Advanced Function Cmdlet': + 'prefix': 'funcadv' + 'body': 'Function ${1:Verb}-${2:Noun} {\n\n<#\n.SYNOPSIS\n\tA brief description of the function or script.\n\n.DESCRIPTION\n\tA detaild description of the function or script.\n\n.PARAMETER Param1\n\tThe description of a parameter. Add a .PARAMETER keyword for each parameter in the function or script syntax.\n\n.PARAMETER Param2\n\tThe description of a parameter.\n\n.INPUTS\n\tThe object input type/s accepted by this cmdlet\n\t(EX: [System.String],[System.Int32])\n\n.OUTPUTS\n\tThe object output type returned by this cmdlet\n\n.EXAMPLE\n\tExample of how to use this cmdlet\n\n.NOTES\n\tAdditional information about the function or script.\n\n.LINK\n\tabout_functions_advanced\n\n.LINK\n\tabout_comment_based_help\n\n.LINK\n\tabout_functions_advanced_parameters\n#>\n\n\t[CmdletBinding()]\n\t[OutputType([System.Nullable])]\n\tParam\n\t(\n\t\t[Parameter(Position=0, Mandatory=$true)]\n\t\t\[System.String]$Param1,\n\n\t\t[Parameter(Position=1, Mandatory=$false)]\n\t\t[System.Int32]$Param2\n\t)\n\n\tBEGIN {\n\n\t\ttry {\n\n\t\t\t # try executing this code\n\n\t\t} catch {\n\n\t\t\t # catch errors; execute this code\n\n\t\t} # end try/catch\n\n\t} # end BEGIN block\n\n\tPROCESS {\n\n\t\ttry {\n\n\t\t\t # try executing this code\n\n\t\t} catch {\n\n\t\t\t # catch errors; execute this code\n\n\t\t} # end try/catch\n\n\t} # end PROCESS block\n\n\tEND {\n\n\t\ttry {\n\n\t\t\t # try executing this code\n\n\t\t} catch {\n\n\t\t\t # catch errors; execute this code\n\n\t\t} # end try/catch\n\n\t} # end END block\n\n} # end function Verb-Noun' 'Switch': 'prefix': 'switch' 'body': 'switch (\$${1:x})\n{\n\t"value1" {}\n\t{\$_ -in "A","B","C"} {}\n\t"value3" {}\n\tDefault {}\n}'