> bash set -e.(really really miss this) Set-PSBreakpoint -Command Write-Error -Action { break; }
similarly: trap { <# IDE breakpoint here #> }
> Find it hard to set a script to abort with a stack trace. $script:ErrorActionPreference = 'Stop'
# or
throw "Oops!"
> Find it hard to deal with relative importsThat'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.: $users = @( Get-ADUser -Filter ... )
This is also the syntax to create an empty array, or an array of one item: $empty = @()
$listOfOne = @( 'foo' )
> 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? # .SYNOPSIS
# This works...
echo 'foo'
|
Why this is not the default behavior when leaking an exception and aborting I have no clue
enforcing things are arrays
Honestly I prefer the bash way of $yaml | yaml2json(.exe) | convert-fromjson. Easier to find cross platform converters which your example is not. Takes me like 5 seconds to write, however then I have to teach others to do it as well, I want it in the platform. Also why they are at it, add toml support as well.for documentation
Also didn't mention this before I wish there was a version of powershell that was static checked like typescript for javascript.