What is the naming convention for Powershell functions with regard to upper/lower case usage?

前端 未结 2 966
小蘑菇
小蘑菇 2020-12-19 02:15

While I did find a lot of information on how to name Cmdlets and functions in the Cmdlet Development Guidelines I did not find any information on whether functions should be

2条回答
  •  温柔的废话
    2020-12-19 03:00

    A function is mostly a script-based cmdlet. A cmdlet is written in ex. C#, while a function is written as a script. Because of this similarity, I recommend using the same style as cmdlets for my "standalone-functions" so that it blends in with the other PowerShell cmdlets. Ex. I had a filecount(per folder)-function that I used often. I called it Get-FileCount.

    However, I usually name helper functions(functions you only use in other functions) using a simpler name like convertsidtousername etc.

    You could use aliases to create short names for a function.

提交回复
热议问题