Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Last active November 4, 2015 20:55
Show Gist options
  • Save JohnL4/d9c5a581646dcc0ab6db to your computer and use it in GitHub Desktop.
Save JohnL4/d9c5a581646dcc0ab6db to your computer and use it in GitHub Desktop.
In PowerShell, dump a dictionary out to the console formatted as a table of key-value rows, with automatic column width and long text wrapped w/in the column
$(curl -uri https://rubygems.org/gems/jekyll-feed).Headers | ft -auto -wrap
<#
$(cmd) is PowerShell's equivalent of bash's backtick command interpolation (`cmd`).
"curl" is a built-in alias for Invoke-WebRequest.
The result of $(cmd) is an object (PowerShell pipes objects, not text), so
".Headers" selects that object property.
The Headers property is a dictionary, so we feed that into Format-Table (built-in alias "ft"),
specifying auto-width and text-wrapping.
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment