Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I work a lot in powershell, and I want to like it. It is built around good ideas.. but oof, every time I have to special case on a return value being either a list or a single item depending on the result-len==1 or not, I die a little inside.


$alwaysList = @( Get-Something )


I think there are some tricks to ensure a list in pwsh for these sort of operations. I vaguely recall ending variable assignments with a comma to avoid this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: