Created
January 9, 2013 15:15
-
-
Save toburger/4493889 to your computer and use it in GitHub Desktop.
Gets the content of a gist which you can then save as a file:
.\Get-GistFile.ps1 gist_id > filename.ext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([Parameter(Mandatory)]$Id) | |
$response = Invoke-WebRequest https://api.github.com/gists/$Id | |
$gist = $response.Content | ConvertFrom-Json | |
$gist.files | gm -MemberType NoteProperty | select -First 1 | % { | |
$file = $gist.files."$($_.Name)" | |
$file.content | |
Write-Verbose "filename: $($file.filename)" | |
Write-Verbose "language: $($file.language)" | |
Write-Verbose "size: $($file.size)" | |
} | |
Write-Verbose "created: $([DateTime]$gist.created_at)" | |
Write-Verbose "updated: $([DateTime]$gist.updated_at)" | |
Write-Verbose "public: $($gist.public)" | |
Write-Verbose "url: $($gist.html_url)" | |
Write-Verbose "comments: $($gist.comments)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment