|
|
|
|
|
by knicknic
1982 days ago
|
|
I like powershell, but miss bash set -e.(really really miss this) Find it hard to set a script to abort with a stack trace. Find it hard to deal with relative imports(this script imports a file in the same folder) explaining the scoping rules Disklike explains how your array is now a single object when you returned it from a function Absolutely love powershell JSON support, miss native yaml support. Love parameter globing Love integration of parameters with a script, dislike that auto generated help can’t be done via single line comment to function |
|
That's a very unfortunate limitation that I've never understood myself, to be honest. The typical "best practice" is to not use relative imports, but to use "installed" modules or scripts instead.
> explaining the scoping rules
https://docs.microsoft.com/en-us/powershell/module/microsoft...
> Disklike explains how your array is now a single object when you returned it from a function
This is also "one of those irritations" that tends to bite people when dealing with search results, e.g.: "Get-ADUser". If you always want an array (even an empty or single-valued array) then wrap functions in @(...), e.g.:
This is also the syntax to create an empty array, or an array of one item: > miss native yaml supportBut this would be trivial to add. Writing a module to provide commandlets such as "ConvertFrom-Yaml" and "ConvertTo-Yaml" is about a day of effort in PowerShell. Good luck doing the same thing in Bash and producing something useful, let alone full-featured!
In fact, someone has done it:
https://github.com/cloudbase/powershell-yaml
> auto generated help can’t be done via single line comment to function
Two lines for automatically generated help is one too many?