Last active
June 23, 2017 13:45
-
-
Save turboBasic/5ba8aa940d117432cbd48a3603e1aec0 to your computer and use it in GitHub Desktop.
Get links to gists, Powershell version. Get links to gists of active github user
This file contains hidden or 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
<# | |
Get list of public gists from GitHub | |
Dependencies: Powershell v3+ | |
ConvertTo-Hashtable: see in my gists | |
2017 Andriy Melnyk https://github.com/TurboBasic | |
#> | |
$DEFAULT_API = 'https://api.github.com/gists' | |
#$DEFAULT_API = 'https://api.github.com/users/USERNAME/gists' | |
Function Get-Gist( [string]$api = 'https://api.github.com/gists' ) { | |
(curl $api | | |
select -expandProperty Content | | |
ConvertFrom-Json) | Foreach-Object { | |
$_currentRecord=$_ | |
$_.files | ConvertTo-Hashtable | | |
Select -expandProperty Values | | |
Foreach-Object { | |
[PSCustomObject]@{ | |
id = $_currentRecord.id; | |
description = $_currentRecord.description; | |
filename = $_.filename; | |
url = $_.raw_url | |
} | |
} | |
} | Format-List filename, url, description | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment