Skip to content

Commit c2c3b7f

Browse files
committed
Completed all UT's
Also: Add abilility to download gists Add Set-GitHubGistStar helper Re-order Content/FileName parameters Switch to [System.IO.File]::ReadAllText() for reading files Add gistfile detection/error handling Add confirmation for removing gist files Add helpers: Remove-GitHubGistFile Set-GitHubGistFile Rename-GitHubGistFile
1 parent 5fe646a commit c2c3b7f

5 files changed

+1768
-106
lines changed

Formatters/GitHubGists.Format.ps1xml

+21-1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<TableColumnHeader>
121121
<Label>ID</Label>
122122
</TableColumnHeader>
123+
<TableColumnHeader>
124+
<Label>owner</Label>
125+
</TableColumnHeader>
123126
<TableColumnHeader>
124127
<Label>Description</Label>
125128
</TableColumnHeader>
@@ -145,6 +148,11 @@
145148
<TableColumnItem>
146149
<PropertyName>id</PropertyName>
147150
</TableColumnItem>
151+
<TableColumnItem>
152+
<ScriptBlock>
153+
($_.owner.login)
154+
</ScriptBlock>
155+
</TableColumnItem>
148156
<TableColumnItem>
149157
<PropertyName>description</PropertyName>
150158
</TableColumnItem>
@@ -203,7 +211,19 @@
203211
</TableColumnItem>
204212
<TableColumnItem>
205213
<ScriptBlock>
206-
($_.owner.login)
214+
# There appears to be a bug in the GitHub API.
215+
# Documentation says that the property should alway be "user",
216+
# but it switches between "owner" and "user" depending on if it's a property
217+
# of a gist, or the direct result from a gist forks query.
218+
# https://github.community/t/gist-api-v3-documentation-incorrect-for-forks/122545
219+
if ($null -eq $_.user)
220+
{
221+
$_.owner.login
222+
}
223+
else
224+
{
225+
$_.user.login
226+
}
207227
</ScriptBlock>
208228
</TableColumnItem>
209229
<TableColumnItem>

0 commit comments

Comments
 (0)