-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.ps1
50 lines (41 loc) · 961 Bytes
/
test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cls
function Send-Gist {
param(
[string]$FileName,
[string]$Content,
[Switch]$ShowWebPage
)
$content = @"
<#
This Gist was created by ISEGist
$(Get-Date)
#>
"@ + $content
$gist = @{
"public"= $true
"description"="Description for $($fileName)"
"files"= @{
"$($fileName)"= @{
"content"= $content
}
}
}
$r = Invoke-RestMethod -Uri 'https://api.github.com/gists' -Method Post -Body ($gist | ConvertTo-Json)
if($ShowWebPage) {
start $r.html_url
} else {
[PSCustomObject]@{
FileName = $FileName
WebPage = $r.html_url
}
}
}
function Send-FileGist {
param(
$FullName,
[Switch]$ShowWebPage
)
Send-Gist (Split-Path -Leaf $FullName) ([System.IO.File]::ReadAllText($FullName)) -ShowWebPage:$ShowWebPage
}
cls
Send-FileGist .\install.ps1