4 ms·
Having to occasionally work with Windows (or more accurately, support people using Windows for tasks that would much better be suited by Linux) makes me aghast
by fivre 8y ago
Having to occasionally work with Windows (or more accurately, support people using Windows for tasks that would much better be suited by Linux) makes me aghast at how bad its CLIs are at very basic interface things.
People who work extensively in Windows environments tell me that Powershell is very, well, powerful, and I'm sure it is for certain select use cases of interacting with Windows' internals. But it's baffling, however, how completely incapable it is of handling basic things like sane, well-explained escaping behavior.
I've attempted to find explanations for how people using Powershell should properly escape JSON (either for sending to HTTP APIs or for setting JSON environment variables when using Docker for Windows) and have concluded that it's basically impossible, as the escaping behavior is so different from *nix shells and appears to be documented nowhere.
Supporting it is further complicated by lack of readily available test environments: even if I wasn't running Linux myself, spinning up a VM is free because there's no software license. This isn't the case with OS X, but I can at least assume that OS X bash works the same as Linux bash for 99% of things. Powershell is completely alien and I know of no free way to try it--maybe Azure provides some variant on their free tier, but I haven't looked into it much (my overall experience trying out Azure was that it was a dumpster fire to be avoided at all costs unless you need cloud AD, in which case it's probably amazing).
- bbatha 8y ago> Powershell should properly escape JSON You can escape things with `. So "{`"foo`": `"an \`"escaped \`" value`"}". Or because powershell has types and objects you can just use native objects and hashes, then pipe it to `ConvertTo-Json` when you need a string.[0] > Powershell is completely alien and I know of no free way to try it Powershell is opensource and cross-platform as of last year. [1] Though its still definitely windows first. 0: http://wahlnetwork.com/2016/02/18/using-powershell-arrays-and-hashtables-with-json-formatting/ http://wahlnetwork.com/2016/02/18/using-powershell-arrays-an... 1: https://github.com/PowerShell/PowerShell https://github.com/PowerShell/PowerShell