1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge branch 'master' into travisci-pro-toggle

This commit is contained in:
Chris Cummer 2018-07-31 13:38:10 -04:00 committed by GitHub
commit a375d54a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1702 additions and 115 deletions

View File

@ -266,6 +266,21 @@
"name": "Tim Fitzgerald", "name": "Tim Fitzgerald",
"avatar_url": "https://avatars1.githubusercontent.com/u/19293566?v=4", "avatar_url": "https://avatars1.githubusercontent.com/u/19293566?v=4",
"profile": "https://github.com/fimtitzgerald", "profile": "https://github.com/fimtitzgerald",
"contributions": []
},
{
"login": "ruggi",
"name": "Federico Ruggi",
"avatar_url": "https://avatars2.githubusercontent.com/u/1081051?v=4",
"profile": "https://github.com/ruggi",
"contributions": [
]
},
{
"login": "ctwoodward",
"name": "Craig Woodward",
"avatar_url": "https://avatars2.githubusercontent.com/u/7293328?v=4",
"profile": "https://github.com/ctwoodward",
"contributions": [ "contributions": [
] ]
} }

18
Gopkg.lock generated
View File

@ -44,13 +44,13 @@
revision = "b23993cbb6353f0e6aa98d0ee318a34728f628b9" revision = "b23993cbb6353f0e6aa98d0ee318a34728f628b9"
[[projects]] [[projects]]
branch = "master"
name = "github.com/gdamore/tcell" name = "github.com/gdamore/tcell"
packages = [ packages = [
".", ".",
"terminfo" "terminfo"
] ]
revision = "de7e78efa4a71b3f36c7154989c529dbdf9ae623" revision = "de7e78efa4a71b3f36c7154989c529dbdf9ae623"
version = "v1.1.0"
[[projects]] [[projects]]
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
@ -62,7 +62,7 @@
branch = "master" branch = "master"
name = "github.com/google/go-github" name = "github.com/google/go-github"
packages = ["github"] packages = ["github"]
revision = "c0b63e2f9bb198baf328c8abf1ddcbe05ff9427e" revision = "77a604e05ff9e668b242334d116bc6d1d0a12d66"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -122,7 +122,7 @@
branch = "master" branch = "master"
name = "github.com/rivo/tview" name = "github.com/rivo/tview"
packages = ["."] packages = ["."]
revision = "c33dd0cf8ef840e1c8905c838d5b1ce93050a825" revision = "6614b16d9037759065eac63d8fb3d8408e63e222"
[[projects]] [[projects]]
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
@ -131,10 +131,10 @@
version = "v1.2.2" version = "v1.2.2"
[[projects]] [[projects]]
branch = "master"
name = "github.com/xanzy/go-gitlab" name = "github.com/xanzy/go-gitlab"
packages = ["."] packages = ["."]
revision = "fb3ece09ef3e80cfa5c1e52dc75fcfb56c12e026" revision = "4f616cbce6a5f335461881701f772d8b8e16c2f6"
version = "v0.10.8"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -155,7 +155,7 @@
"context", "context",
"context/ctxhttp" "context/ctxhttp"
] ]
revision = "8887df42c721e930089d31b28391090a10a497d7" revision = "a0f8a16cb08c06df97cbdf9c47f4731ba548c33c"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -167,7 +167,7 @@
"jws", "jws",
"jwt" "jwt"
] ]
revision = "ef147856a6ddbb60760db74283d2424e98c87bff" revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -191,7 +191,7 @@
"googleapi/internal/uritemplates", "googleapi/internal/uritemplates",
"sheets/v4" "sheets/v4"
] ]
revision = "efcb5f25ac56eae06c8b5672456c0b7767522685" revision = "31ca0e01cd791f07750cb23fc99327721f753290"
[[projects]] [[projects]]
name = "google.golang.org/appengine" name = "google.golang.org/appengine"
@ -219,6 +219,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "44328d9f71a21b64ed00b346dd77be8af49d0542f393f3e17c52de6125c57e24" inputs-digest = "b36355370ccdc4bf6659b1412b29f9da474a922e52a2884f80b7205791e0d304"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -60,7 +60,7 @@ Thanks goes to these wonderful people:
| [<img src="https://avatars0.githubusercontent.com/u/5546718?v=4" width="48px;"/><br /><sub><b>flw</b></sub>](http://flw.tools/)<br /> | [<img src="https://avatars0.githubusercontent.com/u/6024927?v=4" width="48px;"/><br /><sub><b>David Barda</b></sub>](https://github.com/davebarda)<br /> | [<img src="https://avatars2.githubusercontent.com/u/4261980?v=4" width="48px;"/><br /><sub><b>Geoff Lee</b></sub>](https://github.com/matrinox)<br /> | [<img src="https://avatars3.githubusercontent.com/u/1022918?v=4" width="48px;"/><br /><sub><b>George Opritescu</b></sub>](http://international.github.io)<br /> | [<img src="https://avatars3.githubusercontent.com/u/497310?v=4" width="48px;"/><br /><sub><b>Grazfather</b></sub>](https://twitter.com/Grazfather)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1691120?v=4" width="48px;"/><br /><sub><b>Michael Cordell</b></sub>](http://www.mikecordell.com/)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1215497?v=4" width="48px;"/><br /><sub><b>Patrick José Pereira</b></sub>](http://patrick.ibexcps.com)<br /> | | [<img src="https://avatars0.githubusercontent.com/u/5546718?v=4" width="48px;"/><br /><sub><b>flw</b></sub>](http://flw.tools/)<br /> | [<img src="https://avatars0.githubusercontent.com/u/6024927?v=4" width="48px;"/><br /><sub><b>David Barda</b></sub>](https://github.com/davebarda)<br /> | [<img src="https://avatars2.githubusercontent.com/u/4261980?v=4" width="48px;"/><br /><sub><b>Geoff Lee</b></sub>](https://github.com/matrinox)<br /> | [<img src="https://avatars3.githubusercontent.com/u/1022918?v=4" width="48px;"/><br /><sub><b>George Opritescu</b></sub>](http://international.github.io)<br /> | [<img src="https://avatars3.githubusercontent.com/u/497310?v=4" width="48px;"/><br /><sub><b>Grazfather</b></sub>](https://twitter.com/Grazfather)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1691120?v=4" width="48px;"/><br /><sub><b>Michael Cordell</b></sub>](http://www.mikecordell.com/)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1215497?v=4" width="48px;"/><br /><sub><b>Patrick José Pereira</b></sub>](http://patrick.ibexcps.com)<br /> |
| [<img src="https://avatars2.githubusercontent.com/u/1483092?v=4" width="48px;"/><br /><sub><b>sherod taylor</b></sub>](https://github.com/sherodtaylor)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3062663?v=4" width="48px;"/><br /><sub><b>Andrew Scott</b></sub>](http://cogentia.io)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3252403?v=4" width="48px;"/><br /><sub><b>Anand Sudhir Prayaga</b></sub>](https://github.com/anandsudhir)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12018440?v=4" width="48px;"/><br /><sub><b>Lassi Piironen</b></sub>](https://github.com/lsipii)<br /> | [<img src="https://avatars0.githubusercontent.com/u/14799210?v=4" width="48px;"/><br /><sub><b>BlackWebWolf</b></sub>](https://github.com/BlackWebWolf)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1894885?v=4" width="48px;"/><br /><sub><b>andrewzolotukhin</b></sub>](https://github.com/andrewzolotukhin)<br /> | [<img src="https://avatars1.githubusercontent.com/u/8568280?v=4" width="48px;"/><br /><sub><b>Leon Stigter</b></sub>](https://retgits.github.io)<br /> | | [<img src="https://avatars2.githubusercontent.com/u/1483092?v=4" width="48px;"/><br /><sub><b>sherod taylor</b></sub>](https://github.com/sherodtaylor)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3062663?v=4" width="48px;"/><br /><sub><b>Andrew Scott</b></sub>](http://cogentia.io)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3252403?v=4" width="48px;"/><br /><sub><b>Anand Sudhir Prayaga</b></sub>](https://github.com/anandsudhir)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12018440?v=4" width="48px;"/><br /><sub><b>Lassi Piironen</b></sub>](https://github.com/lsipii)<br /> | [<img src="https://avatars0.githubusercontent.com/u/14799210?v=4" width="48px;"/><br /><sub><b>BlackWebWolf</b></sub>](https://github.com/BlackWebWolf)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1894885?v=4" width="48px;"/><br /><sub><b>andrewzolotukhin</b></sub>](https://github.com/andrewzolotukhin)<br /> | [<img src="https://avatars1.githubusercontent.com/u/8568280?v=4" width="48px;"/><br /><sub><b>Leon Stigter</b></sub>](https://retgits.github.io)<br /> |
| [<img src="https://avatars3.githubusercontent.com/u/21756?v=4" width="48px;"/><br /><sub><b>Amr Tamimi</b></sub>](https://tamimi.se)<br /> | [<img src="https://avatars3.githubusercontent.com/u/3717137?v=4" width="48px;"/><br /><sub><b>Jagdeep Singh</b></sub>](https://jagdeep.me)<br /> | [<img src="https://avatars0.githubusercontent.com/u/889171?v=4" width="48px;"/><br /><sub><b>Lineu Felipe</b></sub>](https://github.com/darkSasori)<br /> | [<img src="https://avatars2.githubusercontent.com/u/159124?v=4" width="48px;"/><br /><sub><b>Konstantin</b></sub>](https://github.com/kvj)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6044920?v=4" width="48px;"/><br /><sub><b>Brendan O'Leary</b></sub>](http://www.brendanoleary.com)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1226441?v=4" width="48px;"/><br /><sub><b>bertl4398</b></sub>](https://github.com/bertl4398)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6553695?v=4" width="48px;"/><br /><sub><b>Ferenc-</b></sub>](https://github.com/Ferenc-)<br /> | | [<img src="https://avatars3.githubusercontent.com/u/21756?v=4" width="48px;"/><br /><sub><b>Amr Tamimi</b></sub>](https://tamimi.se)<br /> | [<img src="https://avatars3.githubusercontent.com/u/3717137?v=4" width="48px;"/><br /><sub><b>Jagdeep Singh</b></sub>](https://jagdeep.me)<br /> | [<img src="https://avatars0.githubusercontent.com/u/889171?v=4" width="48px;"/><br /><sub><b>Lineu Felipe</b></sub>](https://github.com/darkSasori)<br /> | [<img src="https://avatars2.githubusercontent.com/u/159124?v=4" width="48px;"/><br /><sub><b>Konstantin</b></sub>](https://github.com/kvj)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6044920?v=4" width="48px;"/><br /><sub><b>Brendan O'Leary</b></sub>](http://www.brendanoleary.com)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1226441?v=4" width="48px;"/><br /><sub><b>bertl4398</b></sub>](https://github.com/bertl4398)<br /> | [<img src="https://avatars2.githubusercontent.com/u/6553695?v=4" width="48px;"/><br /><sub><b>Ferenc-</b></sub>](https://github.com/Ferenc-)<br /> |
| [<img src="https://avatars1.githubusercontent.com/u/952036?v=4" width="48px;"/><br /><sub><b>Rohan Verma</b></sub>](http://rohanverma.net)<br /> | [<img src="https://avatars1.githubusercontent.com/u/19293566?v=4" width="48px;"/><br /><sub><b>Tim Fitzgerald</b></sub>](https://github.com/fimtitzgerald)<br /> | | [<img src="https://avatars1.githubusercontent.com/u/952036?v=4" width="48px;"/><br /><sub><b>Rohan Verma</b></sub>](http://rohanverma.net)<br /> | [<img src="https://avatars1.githubusercontent.com/u/19293566?v=4" width="48px;"/><br /><sub><b>Tim Fitzgerald</b></sub>](https://github.com/fimtitzgerald)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1081051?v=4" width="48px;"/><br /><sub><b>Federico Ruggi</b></sub>](https://github.com/ruggi)<br /> | [<img src="https://avatars2.githubusercontent.com/u/7293328?v=4" width="48px;"/><br /><sub><b>Craig Woodward</b></sub>](https://github.com/ctwoodward)<br /> |
<!-- ALL-CONTRIBUTORS-LIST:END --> <!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

View File

@ -4,7 +4,7 @@ date: 2018-05-09T19:20:20-07:00
draft: false draft: false
--- ---
Displays information about your git repositories hosted on Github: Displays information about your git repositories hosted on GitHub:
#### Open Review Requests #### Open Review Requests
@ -23,21 +23,21 @@ All open pull requests created by you.
wtf/github/ wtf/github/
``` ```
## Github Required ENV Variables ## GitHub Required ENV Variables
<span class="caption">Key:</span> `WTF_GITHUB_TOKEN` <br /> <span class="caption">Key:</span> `WTF_GITHUB_TOKEN` <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">Github API</a> token. <span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">GitHub API</a> token.
## GitHub Enterprise Required ENV Variables ## GitHub Enterprise Required ENV Variables
<span class="caption">Key:</span> `WTF_GITHUB_TOKEN` <br /> <span class="caption">Key:</span> `WTF_GITHUB_TOKEN` <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">Github API</a> token. <span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">GitHub API</a> token.
<span class="caption">Key:</span> `WTF_GITHUB_BASE_URL` <br /> <span class="caption">Key:</span> `WTF_GITHUB_BASE_URL` <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">Github Enterprise</a> API URL. <span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">GitHub Enterprise</a> API URL.
<span class="caption">Key:</span> `WTF_GITHUB_UPLOAD_URL` <br /> <span class="caption">Key:</span> `WTF_GITHUB_UPLOAD_URL` <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">Github Enterprise</a> upload URL (often the same as API URL). <span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">GitHub Enterprise</a> upload URL (often the same as API URL).
## Keyboard Commands ## Keyboard Commands
@ -93,11 +93,11 @@ How often, in seconds, this module will update its data. <br />
Values: A positive integer, `0..n`. Values: A positive integer, `0..n`.
`repositories` <br /> `repositories` <br />
A list of key/value pairs each describing a Github repository to fetch data A list of key/value pairs each describing a GitHub repository to fetch data
for. <br /> for. <br />
<span class="caption">Key:</span> The name of the repository. <br /> <span class="caption">Key:</span> The name of the repository. <br />
<span class="caption">Value:</span> The name of the account or organization that owns the repository. <span class="caption">Value:</span> The name of the account or organization that owns the repository.
`username` <br /> `username` <br />
Your Github username. Used to figure out which review requests you've Your GitHub username. Used to figure out which review requests you've
been added to. been added to.

View File

@ -16,7 +16,7 @@
<p> <p>
Keep an eye on your <strong>OpsGenie</strong> schedules, <strong>Google Calendar</strong>, <strong>Git</strong> Keep an eye on your <strong>OpsGenie</strong> schedules, <strong>Google Calendar</strong>, <strong>Git</strong>
and <strong>Github</strong> repositories, and <strong>New Relic</strong> deployments. and <strong>GitHub</strong> repositories, and <strong>New Relic</strong> deployments.
</p> </p>
<p> <p>
@ -28,7 +28,7 @@
</p> </p>
<a href="https://github.com/senorprogrammer/wtf/releases" class="button button-small">Download Latest</a> <a href="https://github.com/senorprogrammer/wtf/releases" class="button button-small">Download Latest</a>
<a href="https://github.com/senorprogrammer/wtf" class="button button-small">Source on Github</a> <a href="https://github.com/senorprogrammer/wtf" class="button button-small">Source on GitHub</a>
<a href="https://gitter.im/wtfutil/Lobby" class="button button-small">Chat on Gitter</a> <a href="https://gitter.im/wtfutil/Lobby" class="button button-small">Chat on Gitter</a>
<a href="https://twitter.com/wtfutil" class="button button-small">Follow on Twitter</a> <a href="https://twitter.com/wtfutil" class="button button-small">Follow on Twitter</a>

View File

@ -132,7 +132,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<p> <p>
Keep an eye on your <strong>OpsGenie</strong> schedules, <strong>Google Calendar</strong>, <strong>Git</strong> Keep an eye on your <strong>OpsGenie</strong> schedules, <strong>Google Calendar</strong>, <strong>Git</strong>
and <strong>Github</strong> repositories, and <strong>New Relic</strong> deployments. and <strong>GitHub</strong> repositories, and <strong>New Relic</strong> deployments.
</p> </p>
<p> <p>
@ -144,7 +144,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
</p> </p>
<a href="https://github.com/senorprogrammer/wtf/releases" class="button button-small">Download Latest</a> <a href="https://github.com/senorprogrammer/wtf/releases" class="button button-small">Download Latest</a>
<a href="https://github.com/senorprogrammer/wtf" class="button button-small">Source on Github</a> <a href="https://github.com/senorprogrammer/wtf" class="button button-small">Source on GitHub</a>
<a href="https://gitter.im/wtfutil/Lobby" class="button button-small">Chat on Gitter</a> <a href="https://gitter.im/wtfutil/Lobby" class="button button-small">Chat on Gitter</a>
<a href="https://twitter.com/wtfutil" class="button button-small">Follow on Twitter</a> <a href="https://twitter.com/wtfutil" class="button button-small">Follow on Twitter</a>

View File

@ -379,13 +379,13 @@ Configuration gcal:colors:title:&amp;#34;red&amp;#34;description:&amp;#34;lightb
<pubDate>Wed, 09 May 2018 19:20:20 -0700</pubDate> <pubDate>Wed, 09 May 2018 19:20:20 -0700</pubDate>
<guid>https://wtfutil.com/posts/modules/github/</guid> <guid>https://wtfutil.com/posts/modules/github/</guid>
<description>Displays information about your git repositories hosted on Github: <description>Displays information about your git repositories hosted on GitHub:
Open Review Requests All open code review requests assigned to you. Open Review Requests All open code review requests assigned to you.
Open Pull Requests All open pull requests created by you. Open Pull Requests All open pull requests created by you.
Source Code wtf/github/ Github Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your Github API token. Source Code wtf/github/ GitHub Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token.
GitHub Enterprise Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your Github API token. GitHub Enterprise Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token.
Key: WTF_GITHUB_BASE_URL Action: Your Github Enterprise API URL. Key: WTF_GITHUB_BASE_URL Action: Your GitHub Enterprise API URL.
Key: WTF_GITHUB_UPLOAD_URL Action: Your Github Enterprise upload URL (often the same as API URL).</description> Key: WTF_GITHUB_UPLOAD_URL Action: Your GitHub Enterprise upload URL (often the same as API URL).</description>
</item> </item>
<item> <item>

View File

@ -379,13 +379,13 @@ Configuration gcal:colors:title:&amp;#34;red&amp;#34;description:&amp;#34;lightb
<pubDate>Wed, 09 May 2018 19:20:20 -0700</pubDate> <pubDate>Wed, 09 May 2018 19:20:20 -0700</pubDate>
<guid>https://wtfutil.com/posts/modules/github/</guid> <guid>https://wtfutil.com/posts/modules/github/</guid>
<description>Displays information about your git repositories hosted on Github: <description>Displays information about your git repositories hosted on GitHub:
Open Review Requests All open code review requests assigned to you. Open Review Requests All open code review requests assigned to you.
Open Pull Requests All open pull requests created by you. Open Pull Requests All open pull requests created by you.
Source Code wtf/github/ Github Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your Github API token. Source Code wtf/github/ GitHub Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token.
GitHub Enterprise Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your Github API token. GitHub Enterprise Required ENV Variables Key: WTF_GITHUB_TOKEN Action: Your GitHub API token.
Key: WTF_GITHUB_BASE_URL Action: Your Github Enterprise API URL. Key: WTF_GITHUB_BASE_URL Action: Your GitHub Enterprise API URL.
Key: WTF_GITHUB_UPLOAD_URL Action: Your Github Enterprise upload URL (often the same as API URL).</description> Key: WTF_GITHUB_UPLOAD_URL Action: Your GitHub Enterprise upload URL (often the same as API URL).</description>
</item> </item>
<item> <item>

View File

@ -99,7 +99,7 @@
<a href="/posts/modules/git/">Git</a> <a href="/posts/modules/git/">Git</a>
</li> </li>
<li class="sidebar-list-item-2"> <li class="sidebar-list-item-2">
<a href="/posts/modules/github/">Github</a> <a href="/posts/modules/github/">GitHub</a>
</li> </li>
<li class="sidebar-list-item-2"> <li class="sidebar-list-item-2">
<a href="/posts/modules/gcal/">Google Calendar</a> <a href="/posts/modules/gcal/">Google Calendar</a>
@ -204,7 +204,7 @@
</div> </div>
<h3 id="attributes">Attributes</h3> <h3 id="attributes">Attributes</h3>
<p> <p>
<code>enabled</code> <code>enabled</code>
@ -240,4 +240,4 @@
</body> </body>
</html> </html>

View File

@ -96,7 +96,7 @@
<a href="/posts/modules/git/">Git</a> <a href="/posts/modules/git/">Git</a>
</li> </li>
<li class="sidebar-list-item-2"> <li class="sidebar-list-item-2">
<a href="/posts/modules/github/">Github</a> <a href="/posts/modules/github/">GitHub</a>
</li> </li>
<li class="sidebar-list-item-2"> <li class="sidebar-list-item-2">
<a href="/posts/modules/gcal/">Google Calendar</a> <a href="/posts/modules/gcal/">Google Calendar</a>
@ -204,7 +204,7 @@
</div> </div>
<h3 id="attributes">Attributes</h3> <h3 id="attributes">Attributes</h3>
<p> <p>
<code>enabled</code> <code>enabled</code>
@ -240,4 +240,4 @@
</body> </body>
</html> </html>

View File

@ -137,7 +137,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<p>Displays information about your git repositories hosted on Github:</p> <p>Displays information about your git repositories hosted on GitHub:</p>
<h4 id="open-review-requests">Open Review Requests</h4> <h4 id="open-review-requests">Open Review Requests</h4>
@ -151,21 +151,21 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<h2 id="source-code">Source Code</h2> <h2 id="source-code">Source Code</h2>
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/github/</code></pre></div> <div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">wtf/github/</code></pre></div>
<h2 id="github-required-env-variables">Github Required ENV Variables</h2> <h2 id="github-required-env-variables">GitHub Required ENV Variables</h2>
<p><span class="caption">Key:</span> <code>WTF_GITHUB_TOKEN</code> <br /> <p><span class="caption">Key:</span> <code>WTF_GITHUB_TOKEN</code> <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">Github API</a> token.</p> <span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">GitHub API</a> token.</p>
<h2 id="github-enterprise-required-env-variables">GitHub Enterprise Required ENV Variables</h2> <h2 id="github-enterprise-required-env-variables">GitHub Enterprise Required ENV Variables</h2>
<p><span class="caption">Key:</span> <code>WTF_GITHUB_TOKEN</code> <br /> <p><span class="caption">Key:</span> <code>WTF_GITHUB_TOKEN</code> <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">Github API</a> token.</p> <span class="caption">Action:</span> Your <a href="https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization">GitHub API</a> token.</p>
<p><span class="caption">Key:</span> <code>WTF_GITHUB_BASE_URL</code> <br /> <p><span class="caption">Key:</span> <code>WTF_GITHUB_BASE_URL</code> <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">Github Enterprise</a> API URL.</p> <span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">GitHub Enterprise</a> API URL.</p>
<p><span class="caption">Key:</span> <code>WTF_GITHUB_UPLOAD_URL</code> <br /> <p><span class="caption">Key:</span> <code>WTF_GITHUB_UPLOAD_URL</code> <br />
<span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">Github Enterprise</a> upload URL (often the same as API URL).</p> <span class="caption">Action:</span> Your <a href="https://developer.github.com/enterprise/2.13/v3/enterprise-admin/">GitHub Enterprise</a> upload URL (often the same as API URL).</p>
<h2 id="keyboard-commands">Keyboard Commands</h2> <h2 id="keyboard-commands">Keyboard Commands</h2>
@ -217,13 +217,13 @@ How often, in seconds, this module will update its data. <br />
Values: A positive integer, <code>0..n</code>.</p> Values: A positive integer, <code>0..n</code>.</p>
<p><code>repositories</code> <br /> <p><code>repositories</code> <br />
A list of key/value pairs each describing a Github repository to fetch data A list of key/value pairs each describing a GitHub repository to fetch data
for. <br /> for. <br />
<span class="caption">Key:</span> The name of the repository. <br /> <span class="caption">Key:</span> The name of the repository. <br />
<span class="caption">Value:</span> The name of the account or organization that owns the repository.</p> <span class="caption">Value:</span> The name of the account or organization that owns the repository.</p>
<p><code>username</code> <br /> <p><code>username</code> <br />
Your Github username. Used to figure out which review requests you&rsquo;ve Your GitHub username. Used to figure out which review requests you&rsquo;ve
been added to.</p> been added to.</p>
</div> </div>

View File

@ -7,7 +7,7 @@ import (
) )
const HelpText = ` const HelpText = `
Keyboard commands for Github: Keyboard commands for GitHub:
/: Show/hide this help window /: Show/hide this help window
h: Previous git repository h: Previous git repository
@ -30,7 +30,7 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget("Github", "github", true), TextWidget: wtf.NewTextWidget("GitHub", "github", true),
app: app, app: app,
Idx: 0, Idx: 0,

View File

@ -3,6 +3,7 @@ package security
import ( import (
"os/exec" "os/exec"
"runtime" "runtime"
"strings"
"github.com/senorprogrammer/wtf/wtf" "github.com/senorprogrammer/wtf/wtf"
) )
@ -19,6 +20,8 @@ func WifiEncryption() string {
return wifiEncryptionLinux() return wifiEncryptionLinux()
case "darwin": case "darwin":
return wifiEncryptionMacOS() return wifiEncryptionMacOS()
case "windows":
return wifiEncryptionWindows()
default: default:
return "" return ""
} }
@ -30,6 +33,8 @@ func WifiName() string {
return wifiNameLinux() return wifiNameLinux()
case "darwin": case "darwin":
return wifiNameMacOS() return wifiNameMacOS()
case "windows":
return wifiNameWindows()
default: default:
return "" return ""
} }
@ -82,3 +87,36 @@ func matchStr(data [][]string) string {
return data[1][1] return data[1][1]
} }
} }
//Windows
func wifiEncryptionWindows() string {
return parseWlanNetsh("Authentication")
}
func wifiNameWindows() string {
return parseWlanNetsh("SSID")
}
func parseWlanNetsh(target string) string {
cmd := exec.Command("netsh.exe", "wlan", "show", "interfaces")
out, err := cmd.Output()
if err != nil {
return ""
}
splits := strings.Split(string(out), "\n")
var words []string
for _, line := range splits {
token := strings.Split(string(line), ":")
for _, word := range token {
words = append(words, strings.TrimSpace(word))
}
}
for i, token := range words {
switch token {
case target:
return words[i+1]
i++
}
}
return "N/A"
}

View File

@ -146,6 +146,7 @@ Sahil Dua <sahildua2305@gmail.com>
saisi <saisi@users.noreply.github.com> saisi <saisi@users.noreply.github.com>
Sam Minnée <sam@silverstripe.com> Sam Minnée <sam@silverstripe.com>
Sander van Harmelen <svanharmelen@schubergphilis.com> Sander van Harmelen <svanharmelen@schubergphilis.com>
Sanket Payghan <sanket.payghan8@gmail.com>
Sarasa Kisaragi <lingsamuelgrace@gmail.com> Sarasa Kisaragi <lingsamuelgrace@gmail.com>
Sean Wang <sean@decrypted.org> Sean Wang <sean@decrypted.org>
Sebastian Mandrean <sebastian.mandrean@gmail.com> Sebastian Mandrean <sebastian.mandrean@gmail.com>

View File

@ -32,6 +32,10 @@ func (e Event) String() string {
// a value of the corresponding struct type will be returned. // a value of the corresponding struct type will be returned.
func (e *Event) ParsePayload() (payload interface{}, err error) { func (e *Event) ParsePayload() (payload interface{}, err error) {
switch *e.Type { switch *e.Type {
case "CheckRunEvent":
payload = &CheckRunEvent{}
case "CheckSuiteEvent":
payload = &CheckSuiteEvent{}
case "CommitCommentEvent": case "CommitCommentEvent":
payload = &CommitCommentEvent{} payload = &CommitCommentEvent{}
case "CreateEvent": case "CreateEvent":

View File

@ -74,9 +74,6 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opt *ListOptions) ([
return nil, nil, err return nil, nil, err
} }
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMarketplacePreview)
var plans []*MarketplacePlan var plans []*MarketplacePlan
resp, err := s.client.Do(ctx, req, &plans) resp, err := s.client.Do(ctx, req, &plans)
if err != nil { if err != nil {
@ -101,9 +98,6 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID
return nil, nil, err return nil, nil, err
} }
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMarketplacePreview)
var accounts []*MarketplacePlanAccount var accounts []*MarketplacePlanAccount
resp, err := s.client.Do(ctx, req, &accounts) resp, err := s.client.Do(ctx, req, &accounts)
if err != nil { if err != nil {
@ -128,9 +122,6 @@ func (s *MarketplaceService) ListPlanAccountsForAccount(ctx context.Context, acc
return nil, nil, err return nil, nil, err
} }
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMarketplacePreview)
var accounts []*MarketplacePlanAccount var accounts []*MarketplacePlanAccount
resp, err := s.client.Do(ctx, req, &accounts) resp, err := s.client.Do(ctx, req, &accounts)
if err != nil { if err != nil {
@ -159,9 +150,6 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context
return nil, nil, err return nil, nil, err
} }
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMarketplacePreview)
var purchases []*MarketplacePurchase var purchases []*MarketplacePurchase
resp, err := s.client.Do(ctx, req, &purchases) resp, err := s.client.Do(ctx, req, &purchases)
if err != nil { if err != nil {

428
vendor/github.com/google/go-github/github/checks.go generated vendored Normal file
View File

@ -0,0 +1,428 @@
// Copyright 2018 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"fmt"
)
// ChecksService provides access to the Checks API in the
// GitHub API.
//
// GitHub API docs: https://developer.github.com/v3/checks/
type ChecksService service
// CheckRun represents a GitHub check run on a repository associated with a GitHub app.
type CheckRun struct {
ID *int64 `json:"id,omitempty"`
HeadSHA *string `json:"head_sha,omitempty"`
ExternalID *string `json:"external_id,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
Status *string `json:"status,omitempty"`
Conclusion *string `json:"conclusion,omitempty"`
StartedAt *Timestamp `json:"started_at,omitempty"`
CompletedAt *Timestamp `json:"completed_at,omitempty"`
Output *CheckRunOutput `json:"output,omitempty"`
Name *string `json:"name,omitempty"`
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
App *App `json:"app,omitempty"`
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
}
// CheckRunOutput represents the output of a CheckRun.
type CheckRunOutput struct {
Title *string `json:"title,omitempty"`
Summary *string `json:"summary,omitempty"`
Text *string `json:"text,omitempty"`
AnnotationsCount *int `json:"annotations_count,omitempty"`
AnnotationsURL *string `json:"annotations_url,omitempty"`
Annotations []*CheckRunAnnotation `json:"annotations,omitempty"`
Images []*CheckRunImage `json:"images,omitempty"`
}
// CheckRunAnnotation represents an annotation object for a CheckRun output.
type CheckRunAnnotation struct {
FileName *string `json:"filename,omitempty"`
BlobHRef *string `json:"blob_href,omitempty"`
StartLine *int `json:"start_line,omitempty"`
EndLine *int `json:"end_line,omitempty"`
WarningLevel *string `json:"warning_level,omitempty"`
Message *string `json:"message,omitempty"`
Title *string `json:"title,omitempty"`
RawDetails *string `json:"raw_details,omitempty"`
}
// CheckRunImage represents an image object for a CheckRun output.
type CheckRunImage struct {
Alt *string `json:"alt,omitempty"`
ImageURL *string `json:"image_url,omitempty"`
Caption *string `json:"caption,omitempty"`
}
// CheckSuite represents a suite of check runs.
type CheckSuite struct {
ID *int64 `json:"id,omitempty"`
HeadBranch *string `json:"head_branch,omitempty"`
HeadSHA *string `json:"head_sha,omitempty"`
URL *string `json:"url,omitempty"`
BeforeSHA *string `json:"before,omitempty"`
AfterSHA *string `json:"after,omitempty"`
Status *string `json:"status,omitempty"`
Conclusion *string `json:"conclusion,omitempty"`
App *App `json:"app,omitempty"`
Repository *Repository `json:"repository,omitempty"`
PullRequests []*PullRequest `json:"pull_requests,omitempty"`
}
func (c CheckRun) String() string {
return Stringify(c)
}
func (c CheckSuite) String() string {
return Stringify(c)
}
// GetCheckRun gets a check-run for a repository.
//
// GitHub API docs: https://developer.github.com/v3/checks/runs/#get-a-single-check-run
func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
checkRun := new(CheckRun)
resp, err := s.client.Do(ctx, req, checkRun)
if err != nil {
return nil, resp, err
}
return checkRun, resp, nil
}
// GetCheckSuite gets a single check suite.
//
// GitHub API docs: https://developer.github.com/v3/checks/suites/#get-a-single-check-suite
func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
checkSuite := new(CheckSuite)
resp, err := s.client.Do(ctx, req, checkSuite)
if err != nil {
return nil, resp, err
}
return checkSuite, resp, nil
}
// CreateCheckRunOptions sets up parameters needed to create a CheckRun.
type CreateCheckRunOptions struct {
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
HeadBranch string `json:"head_branch"` // The name of the branch to perform a check against. (Required.)
HeadSHA string `json:"head_sha"` // The SHA of the commit. (Required.)
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
StartedAt *Timestamp `json:"started_at,omitempty"` // The time that the check run began. (Optional.)
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
}
// CreateCheckRun creates a check run for repository.
//
// GitHub API docs: https://developer.github.com/v3/checks/runs/#create-a-check-run
func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opt CreateCheckRunOptions) (*CheckRun, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo)
req, err := s.client.NewRequest("POST", u, opt)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
checkRun := new(CheckRun)
resp, err := s.client.Do(ctx, req, checkRun)
if err != nil {
return nil, resp, err
}
return checkRun, resp, nil
}
// UpdateCheckRunOptions sets up parameters needed to update a CheckRun.
type UpdateCheckRunOptions struct {
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
HeadBranch *string `json:"head_branch,omitempty"` // The name of the branch to perform a check against. (Optional.)
HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.)
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
}
// UpdateCheckRun updates a check run for a specific commit in a repository.
//
// GitHub API docs: https://developer.github.com/v3/checks/runs/#update-a-check-run
func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opt UpdateCheckRunOptions) (*CheckRun, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID)
req, err := s.client.NewRequest("PATCH", u, opt)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
checkRun := new(CheckRun)
resp, err := s.client.Do(ctx, req, checkRun)
if err != nil {
return nil, resp, err
}
return checkRun, resp, nil
}
// ListCheckRunAnnotations lists the annotations for a check run.
//
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-annotations-for-a-check-run
func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opt *ListOptions) ([]*CheckRunAnnotation, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID)
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
var checkRunAnnotations []*CheckRunAnnotation
resp, err := s.client.Do(ctx, req, &checkRunAnnotations)
if err != nil {
return nil, resp, err
}
return checkRunAnnotations, resp, nil
}
// ListCheckRunsOptions represents parameters to list check runs.
type ListCheckRunsOptions struct {
CheckName *string `url:"check_name,omitempty"` // Returns check runs with the specified name.
Status *string `url:"status,omitempty"` // Returns check runs with the specified status. Can be one of "queued", "in_progress", or "completed".
Filter *string `url:"filter,omitempty"` // Filters check runs by their completed_at timestamp. Can be one of "latest" (returning the most recent check runs) or "all". Default: "latest"
ListOptions
}
// ListCheckRunsResults represents the result of a check run list.
type ListCheckRunsResults struct {
Total *int `json:"total_count,omitempty"`
CheckRuns []*CheckRun `json:"check_runs,omitempty"`
}
// ListCheckRunsForRef lists check runs for a specific ref.
//
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref
func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, ref)
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
var checkRunResults *ListCheckRunsResults
resp, err := s.client.Do(ctx, req, &checkRunResults)
if err != nil {
return nil, resp, err
}
return checkRunResults, resp, nil
}
// ListCheckRunsCheckSuite lists check runs for a check suite.
//
// GitHub API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-in-a-check-suite
func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opt *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID)
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
var checkRunResults *ListCheckRunsResults
resp, err := s.client.Do(ctx, req, &checkRunResults)
if err != nil {
return nil, resp, err
}
return checkRunResults, resp, nil
}
// ListCheckSuiteOptions represents parameters to list check suites.
type ListCheckSuiteOptions struct {
CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run.
AppID *int `url:"app_id,omitempty"` // Filters check suites by GitHub App id.
ListOptions
}
// ListCheckSuiteResults represents the result of a check run list.
type ListCheckSuiteResults struct {
Total *int `json:"total_count,omitempty"`
CheckSuites []*CheckSuite `json:"check_suites,omitempty"`
}
// ListCheckSuitesForRef lists check suite for a specific ref.
//
// GitHub API docs: https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref
func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opt *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, ref)
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
var checkSuiteResults *ListCheckSuiteResults
resp, err := s.client.Do(ctx, req, &checkSuiteResults)
if err != nil {
return nil, resp, err
}
return checkSuiteResults, resp, nil
}
// AutoTriggerCheck enables or disables automatic creation of CheckSuite events upon pushes to the repository.
type AutoTriggerCheck struct {
AppID *int64 `json:"app_id,omitempty"` // The id of the GitHub App. (Required.)
Setting *bool `json:"setting,omitempty"` // Set to "true" to enable automatic creation of CheckSuite events upon pushes to the repository, or "false" to disable them. Default: "true" (Required.)
}
// CheckSuitePreferenceOptions set options for check suite preferences for a repository.
type CheckSuitePreferenceOptions struct {
PreferenceList *PreferenceList `json:"auto_trigger_checks,omitempty"` // A list of auto trigger checks that can be set for a check suite in a repository.
}
// CheckSuitePreferenceResults represents the results of the preference set operation.
type CheckSuitePreferenceResults struct {
Preferences *PreferenceList `json:"preferences,omitempty"`
Repository *Repository `json:"repository,omitempty"`
}
// PreferenceList represents a list of auto trigger checks for repository
type PreferenceList struct {
AutoTriggerChecks []*AutoTriggerCheck `json:"auto_trigger_checks,omitempty"` // A slice of auto trigger checks that can be set for a check suite in a repository.
}
// SetCheckSuitePreferences changes the default automatic flow when creating check suites.
//
// GitHub API docs: https://developer.github.com/v3/checks/suites/#set-preferences-for-check-suites-on-a-repository
func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opt CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo)
req, err := s.client.NewRequest("PATCH", u, opt)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
var checkSuitePrefResults *CheckSuitePreferenceResults
resp, err := s.client.Do(ctx, req, &checkSuitePrefResults)
if err != nil {
return nil, resp, err
}
return checkSuitePrefResults, resp, nil
}
// CreateCheckSuiteOptions sets up parameters to manually create a check suites
type CreateCheckSuiteOptions struct {
HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.)
HeadBranch *string `json:"head_branch,omitempty"` // The name of the head branch where the code changes are implemented.
}
// CreateCheckSuite manually creates a check suite for a repository.
//
// GitHub API docs: https://developer.github.com/v3/checks/suites/#create-a-check-suite
func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opt CreateCheckSuiteOptions) (*CheckSuite, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo)
req, err := s.client.NewRequest("POST", u, opt)
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
checkSuite := new(CheckSuite)
resp, err := s.client.Do(ctx, req, checkSuite)
if err != nil {
return nil, resp, err
}
return checkSuite, resp, nil
}
// RequestCheckSuiteOptions sets up the parameters for a request check suite endpoint.
type RequestCheckSuiteOptions struct {
HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.)
}
// RequestCheckSuite triggers GitHub to create a new check suite, without pushing new code to a repository.
//
// GitHub API docs: https://developer.github.com/v3/checks/suites/#request-check-suites
func (s *ChecksService) RequestCheckSuite(ctx context.Context, owner, repo string, opt RequestCheckSuiteOptions) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/check-suite-requests", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
return nil, err
}
req, err := s.client.NewRequest("POST", u, nil)
if err != nil {
return nil, err
}
req.Header.Set("Accept", mediaTypeCheckRunsPreview)
resp, err := s.client.Do(ctx, req, nil)
return resp, err
}

View File

@ -7,6 +7,38 @@
package github package github
// CheckRunEvent is triggered when a check run is "created", "updated", or "re-requested".
// The Webhook event name is "check_run".
//
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent
type CheckRunEvent struct {
CheckRun *CheckRun `json:"check_run,omitempty"`
// The action performed. Can be "created", "updated" or "re-requested".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "re-requested".
// The Webhook event name is "check_suite".
//
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checksuiteevent
type CheckSuiteEvent struct {
CheckSuite *CheckSuite `json:"check_suite,omitempty"`
// The action performed. Can be "completed", "requested" or "re-requested".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}
// CommitCommentEvent is triggered when a commit comment is created. // CommitCommentEvent is triggered when a commit comment is created.
// The Webhook event name is "commit_comment". // The Webhook event name is "commit_comment".
// //

View File

@ -364,6 +364,22 @@ func (a *AuthorizationUpdateRequest) GetNoteURL() string {
return *a.NoteURL return *a.NoteURL
} }
// GetAppID returns the AppID field if it's non-nil, zero value otherwise.
func (a *AutoTriggerCheck) GetAppID() int64 {
if a == nil || a.AppID == nil {
return 0
}
return *a.AppID
}
// GetSetting returns the Setting field if it's non-nil, zero value otherwise.
func (a *AutoTriggerCheck) GetSetting() bool {
if a == nil || a.Setting == nil {
return false
}
return *a.Setting
}
// GetContent returns the Content field if it's non-nil, zero value otherwise. // GetContent returns the Content field if it's non-nil, zero value otherwise.
func (b *Blob) GetContent() string { func (b *Blob) GetContent() string {
if b == nil || b.Content == nil { if b == nil || b.Content == nil {
@ -436,6 +452,438 @@ func (b *Branch) GetProtected() bool {
return *b.Protected return *b.Protected
} }
// GetApp returns the App field.
func (c *CheckRun) GetApp() *App {
if c == nil {
return nil
}
return c.App
}
// GetCheckSuite returns the CheckSuite field.
func (c *CheckRun) GetCheckSuite() *CheckSuite {
if c == nil {
return nil
}
return c.CheckSuite
}
// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetCompletedAt() Timestamp {
if c == nil || c.CompletedAt == nil {
return Timestamp{}
}
return *c.CompletedAt
}
// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetConclusion() string {
if c == nil || c.Conclusion == nil {
return ""
}
return *c.Conclusion
}
// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetExternalID() string {
if c == nil || c.ExternalID == nil {
return ""
}
return *c.ExternalID
}
// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetHeadSHA() string {
if c == nil || c.HeadSHA == nil {
return ""
}
return *c.HeadSHA
}
// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetHTMLURL() string {
if c == nil || c.HTMLURL == nil {
return ""
}
return *c.HTMLURL
}
// GetID returns the ID field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetID() int64 {
if c == nil || c.ID == nil {
return 0
}
return *c.ID
}
// GetName returns the Name field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetName() string {
if c == nil || c.Name == nil {
return ""
}
return *c.Name
}
// GetOutput returns the Output field.
func (c *CheckRun) GetOutput() *CheckRunOutput {
if c == nil {
return nil
}
return c.Output
}
// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetStartedAt() Timestamp {
if c == nil || c.StartedAt == nil {
return Timestamp{}
}
return *c.StartedAt
}
// GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetStatus() string {
if c == nil || c.Status == nil {
return ""
}
return *c.Status
}
// GetURL returns the URL field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetURL() string {
if c == nil || c.URL == nil {
return ""
}
return *c.URL
}
// GetBlobHRef returns the BlobHRef field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetBlobHRef() string {
if c == nil || c.BlobHRef == nil {
return ""
}
return *c.BlobHRef
}
// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetEndLine() int {
if c == nil || c.EndLine == nil {
return 0
}
return *c.EndLine
}
// GetFileName returns the FileName field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetFileName() string {
if c == nil || c.FileName == nil {
return ""
}
return *c.FileName
}
// GetMessage returns the Message field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetMessage() string {
if c == nil || c.Message == nil {
return ""
}
return *c.Message
}
// GetRawDetails returns the RawDetails field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetRawDetails() string {
if c == nil || c.RawDetails == nil {
return ""
}
return *c.RawDetails
}
// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetStartLine() int {
if c == nil || c.StartLine == nil {
return 0
}
return *c.StartLine
}
// GetTitle returns the Title field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetTitle() string {
if c == nil || c.Title == nil {
return ""
}
return *c.Title
}
// GetWarningLevel returns the WarningLevel field if it's non-nil, zero value otherwise.
func (c *CheckRunAnnotation) GetWarningLevel() string {
if c == nil || c.WarningLevel == nil {
return ""
}
return *c.WarningLevel
}
// GetAction returns the Action field if it's non-nil, zero value otherwise.
func (c *CheckRunEvent) GetAction() string {
if c == nil || c.Action == nil {
return ""
}
return *c.Action
}
// GetCheckRun returns the CheckRun field.
func (c *CheckRunEvent) GetCheckRun() *CheckRun {
if c == nil {
return nil
}
return c.CheckRun
}
// GetInstallation returns the Installation field.
func (c *CheckRunEvent) GetInstallation() *Installation {
if c == nil {
return nil
}
return c.Installation
}
// GetOrg returns the Org field.
func (c *CheckRunEvent) GetOrg() *Organization {
if c == nil {
return nil
}
return c.Org
}
// GetRepo returns the Repo field.
func (c *CheckRunEvent) GetRepo() *Repository {
if c == nil {
return nil
}
return c.Repo
}
// GetSender returns the Sender field.
func (c *CheckRunEvent) GetSender() *User {
if c == nil {
return nil
}
return c.Sender
}
// GetAlt returns the Alt field if it's non-nil, zero value otherwise.
func (c *CheckRunImage) GetAlt() string {
if c == nil || c.Alt == nil {
return ""
}
return *c.Alt
}
// GetCaption returns the Caption field if it's non-nil, zero value otherwise.
func (c *CheckRunImage) GetCaption() string {
if c == nil || c.Caption == nil {
return ""
}
return *c.Caption
}
// GetImageURL returns the ImageURL field if it's non-nil, zero value otherwise.
func (c *CheckRunImage) GetImageURL() string {
if c == nil || c.ImageURL == nil {
return ""
}
return *c.ImageURL
}
// GetAnnotationsCount returns the AnnotationsCount field if it's non-nil, zero value otherwise.
func (c *CheckRunOutput) GetAnnotationsCount() int {
if c == nil || c.AnnotationsCount == nil {
return 0
}
return *c.AnnotationsCount
}
// GetAnnotationsURL returns the AnnotationsURL field if it's non-nil, zero value otherwise.
func (c *CheckRunOutput) GetAnnotationsURL() string {
if c == nil || c.AnnotationsURL == nil {
return ""
}
return *c.AnnotationsURL
}
// GetSummary returns the Summary field if it's non-nil, zero value otherwise.
func (c *CheckRunOutput) GetSummary() string {
if c == nil || c.Summary == nil {
return ""
}
return *c.Summary
}
// GetText returns the Text field if it's non-nil, zero value otherwise.
func (c *CheckRunOutput) GetText() string {
if c == nil || c.Text == nil {
return ""
}
return *c.Text
}
// GetTitle returns the Title field if it's non-nil, zero value otherwise.
func (c *CheckRunOutput) GetTitle() string {
if c == nil || c.Title == nil {
return ""
}
return *c.Title
}
// GetAfterSHA returns the AfterSHA field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetAfterSHA() string {
if c == nil || c.AfterSHA == nil {
return ""
}
return *c.AfterSHA
}
// GetApp returns the App field.
func (c *CheckSuite) GetApp() *App {
if c == nil {
return nil
}
return c.App
}
// GetBeforeSHA returns the BeforeSHA field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetBeforeSHA() string {
if c == nil || c.BeforeSHA == nil {
return ""
}
return *c.BeforeSHA
}
// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetConclusion() string {
if c == nil || c.Conclusion == nil {
return ""
}
return *c.Conclusion
}
// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetHeadBranch() string {
if c == nil || c.HeadBranch == nil {
return ""
}
return *c.HeadBranch
}
// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetHeadSHA() string {
if c == nil || c.HeadSHA == nil {
return ""
}
return *c.HeadSHA
}
// GetID returns the ID field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetID() int64 {
if c == nil || c.ID == nil {
return 0
}
return *c.ID
}
// GetRepository returns the Repository field.
func (c *CheckSuite) GetRepository() *Repository {
if c == nil {
return nil
}
return c.Repository
}
// GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetStatus() string {
if c == nil || c.Status == nil {
return ""
}
return *c.Status
}
// GetURL returns the URL field if it's non-nil, zero value otherwise.
func (c *CheckSuite) GetURL() string {
if c == nil || c.URL == nil {
return ""
}
return *c.URL
}
// GetAction returns the Action field if it's non-nil, zero value otherwise.
func (c *CheckSuiteEvent) GetAction() string {
if c == nil || c.Action == nil {
return ""
}
return *c.Action
}
// GetCheckSuite returns the CheckSuite field.
func (c *CheckSuiteEvent) GetCheckSuite() *CheckSuite {
if c == nil {
return nil
}
return c.CheckSuite
}
// GetInstallation returns the Installation field.
func (c *CheckSuiteEvent) GetInstallation() *Installation {
if c == nil {
return nil
}
return c.Installation
}
// GetOrg returns the Org field.
func (c *CheckSuiteEvent) GetOrg() *Organization {
if c == nil {
return nil
}
return c.Org
}
// GetRepo returns the Repo field.
func (c *CheckSuiteEvent) GetRepo() *Repository {
if c == nil {
return nil
}
return c.Repo
}
// GetSender returns the Sender field.
func (c *CheckSuiteEvent) GetSender() *User {
if c == nil {
return nil
}
return c.Sender
}
// GetPreferenceList returns the PreferenceList field.
func (c *CheckSuitePreferenceOptions) GetPreferenceList() *PreferenceList {
if c == nil {
return nil
}
return c.PreferenceList
}
// GetPreferences returns the Preferences field.
func (c *CheckSuitePreferenceResults) GetPreferences() *PreferenceList {
if c == nil {
return nil
}
return c.Preferences
}
// GetRepository returns the Repository field.
func (c *CheckSuitePreferenceResults) GetRepository() *Repository {
if c == nil {
return nil
}
return c.Repository
}
// GetBody returns the Body field if it's non-nil, zero value otherwise. // GetBody returns the Body field if it's non-nil, zero value otherwise.
func (c *CodeOfConduct) GetBody() string { func (c *CodeOfConduct) GetBody() string {
if c == nil || c.Body == nil { if c == nil || c.Body == nil {
@ -1060,6 +1508,14 @@ func (c *CommunityHealthFiles) GetContributing() *Metric {
return c.Contributing return c.Contributing
} }
// GetIssueTemplate returns the IssueTemplate field.
func (c *CommunityHealthFiles) GetIssueTemplate() *Metric {
if c == nil {
return nil
}
return c.IssueTemplate
}
// GetLicense returns the License field. // GetLicense returns the License field.
func (c *CommunityHealthFiles) GetLicense() *Metric { func (c *CommunityHealthFiles) GetLicense() *Metric {
if c == nil { if c == nil {
@ -1068,6 +1524,14 @@ func (c *CommunityHealthFiles) GetLicense() *Metric {
return c.License return c.License
} }
// GetPullRequestTemplate returns the PullRequestTemplate field.
func (c *CommunityHealthFiles) GetPullRequestTemplate() *Metric {
if c == nil {
return nil
}
return c.PullRequestTemplate
}
// GetReadme returns the Readme field. // GetReadme returns the Readme field.
func (c *CommunityHealthFiles) GetReadme() *Metric { func (c *CommunityHealthFiles) GetReadme() *Metric {
if c == nil { if c == nil {
@ -1260,6 +1724,70 @@ func (c *ContributorStats) GetTotal() int {
return *c.Total return *c.Total
} }
// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise.
func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp {
if c == nil || c.CompletedAt == nil {
return Timestamp{}
}
return *c.CompletedAt
}
// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise.
func (c *CreateCheckRunOptions) GetConclusion() string {
if c == nil || c.Conclusion == nil {
return ""
}
return *c.Conclusion
}
// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise.
func (c *CreateCheckRunOptions) GetDetailsURL() string {
if c == nil || c.DetailsURL == nil {
return ""
}
return *c.DetailsURL
}
// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (c *CreateCheckRunOptions) GetExternalID() string {
if c == nil || c.ExternalID == nil {
return ""
}
return *c.ExternalID
}
// GetOutput returns the Output field.
func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput {
if c == nil {
return nil
}
return c.Output
}
// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise.
func (c *CreateCheckRunOptions) GetStartedAt() Timestamp {
if c == nil || c.StartedAt == nil {
return Timestamp{}
}
return *c.StartedAt
}
// GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (c *CreateCheckRunOptions) GetStatus() string {
if c == nil || c.Status == nil {
return ""
}
return *c.Status
}
// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise.
func (c *CreateCheckSuiteOptions) GetHeadBranch() string {
if c == nil || c.HeadBranch == nil {
return ""
}
return *c.HeadBranch
}
// GetDescription returns the Description field if it's non-nil, zero value otherwise. // GetDescription returns the Description field if it's non-nil, zero value otherwise.
func (c *CreateEvent) GetDescription() string { func (c *CreateEvent) GetDescription() string {
if c == nil || c.Description == nil { if c == nil || c.Description == nil {
@ -4004,6 +4532,62 @@ func (l *License) GetURL() string {
return *l.URL return *l.URL
} }
// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise.
func (l *ListCheckRunsOptions) GetCheckName() string {
if l == nil || l.CheckName == nil {
return ""
}
return *l.CheckName
}
// GetFilter returns the Filter field if it's non-nil, zero value otherwise.
func (l *ListCheckRunsOptions) GetFilter() string {
if l == nil || l.Filter == nil {
return ""
}
return *l.Filter
}
// GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (l *ListCheckRunsOptions) GetStatus() string {
if l == nil || l.Status == nil {
return ""
}
return *l.Status
}
// GetTotal returns the Total field if it's non-nil, zero value otherwise.
func (l *ListCheckRunsResults) GetTotal() int {
if l == nil || l.Total == nil {
return 0
}
return *l.Total
}
// GetAppID returns the AppID field if it's non-nil, zero value otherwise.
func (l *ListCheckSuiteOptions) GetAppID() int {
if l == nil || l.AppID == nil {
return 0
}
return *l.AppID
}
// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise.
func (l *ListCheckSuiteOptions) GetCheckName() string {
if l == nil || l.CheckName == nil {
return ""
}
return *l.CheckName
}
// GetTotal returns the Total field if it's non-nil, zero value otherwise.
func (l *ListCheckSuiteResults) GetTotal() int {
if l == nil || l.Total == nil {
return 0
}
return *l.Total
}
// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. // GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise.
func (m *MarketplacePlan) GetAccountsURL() string { func (m *MarketplacePlan) GetAccountsURL() string {
if m == nil || m.AccountsURL == nil { if m == nil || m.AccountsURL == nil {
@ -5596,6 +6180,14 @@ func (p *Project) GetURL() string {
return *p.URL return *p.URL
} }
// GetArchived returns the Archived field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetArchived() bool {
if p == nil || p.Archived == nil {
return false
}
return *p.Archived
}
// GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise. // GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetColumnID() int64 { func (p *ProjectCard) GetColumnID() int64 {
if p == nil || p.ColumnID == nil { if p == nil || p.ColumnID == nil {
@ -5740,6 +6332,22 @@ func (p *ProjectCardEvent) GetSender() *User {
return p.Sender return p.Sender
} }
// GetArchivedState returns the ArchivedState field if it's non-nil, zero value otherwise.
func (p *ProjectCardListOptions) GetArchivedState() string {
if p == nil || p.ArchivedState == nil {
return ""
}
return *p.ArchivedState
}
// GetArchived returns the Archived field if it's non-nil, zero value otherwise.
func (p *ProjectCardOptions) GetArchived() bool {
if p == nil || p.Archived == nil {
return false
}
return *p.Archived
}
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (p *ProjectColumn) GetCreatedAt() Timestamp { func (p *ProjectColumn) GetCreatedAt() Timestamp {
if p == nil || p.CreatedAt == nil { if p == nil || p.CreatedAt == nil {
@ -10260,6 +10868,70 @@ func (t *TreeEntry) GetURL() string {
return *t.URL return *t.URL
} }
// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp {
if u == nil || u.CompletedAt == nil {
return Timestamp{}
}
return *u.CompletedAt
}
// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetConclusion() string {
if u == nil || u.Conclusion == nil {
return ""
}
return *u.Conclusion
}
// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetDetailsURL() string {
if u == nil || u.DetailsURL == nil {
return ""
}
return *u.DetailsURL
}
// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetExternalID() string {
if u == nil || u.ExternalID == nil {
return ""
}
return *u.ExternalID
}
// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetHeadBranch() string {
if u == nil || u.HeadBranch == nil {
return ""
}
return *u.HeadBranch
}
// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetHeadSHA() string {
if u == nil || u.HeadSHA == nil {
return ""
}
return *u.HeadSHA
}
// GetOutput returns the Output field.
func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput {
if u == nil {
return nil
}
return u.Output
}
// GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (u *UpdateCheckRunOptions) GetStatus() string {
if u == nil || u.Status == nil {
return ""
}
return *u.Status
}
// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. // GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
func (u *User) GetAvatarURL() string { func (u *User) GetAvatarURL() string {
if u == nil || u.AvatarURL == nil { if u == nil || u.AvatarURL == nil {
@ -10724,6 +11396,70 @@ func (u *UserLDAPMapping) GetURL() string {
return *u.URL return *u.URL
} }
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetCreatedAt() string {
if u == nil || u.CreatedAt == nil {
return ""
}
return *u.CreatedAt
}
// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetExcludeAttachments() bool {
if u == nil || u.ExcludeAttachments == nil {
return false
}
return *u.ExcludeAttachments
}
// GetGUID returns the GUID field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetGUID() string {
if u == nil || u.GUID == nil {
return ""
}
return *u.GUID
}
// GetID returns the ID field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetID() int64 {
if u == nil || u.ID == nil {
return 0
}
return *u.ID
}
// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetLockRepositories() bool {
if u == nil || u.LockRepositories == nil {
return false
}
return *u.LockRepositories
}
// GetState returns the State field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetState() string {
if u == nil || u.State == nil {
return ""
}
return *u.State
}
// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetUpdatedAt() string {
if u == nil || u.UpdatedAt == nil {
return ""
}
return *u.UpdatedAt
}
// GetURL returns the URL field if it's non-nil, zero value otherwise.
func (u *UserMigration) GetURL() string {
if u == nil || u.URL == nil {
return ""
}
return *u.URL
}
// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
func (u *UsersSearchResult) GetIncompleteResults() bool { func (u *UsersSearchResult) GetIncompleteResults() bool {
if u == nil || u.IncompleteResults == nil { if u == nil || u.IncompleteResults == nil {

View File

@ -96,9 +96,6 @@ const (
// https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/ // https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/
mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json" mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json"
// https://developer.github.com/v3/apps/marketplace/
mediaTypeMarketplacePreview = "application/vnd.github.valkyrie-preview+json"
// https://developer.github.com/changes/2017-08-30-preview-nested-teams/ // https://developer.github.com/changes/2017-08-30-preview-nested-teams/
mediaTypeNestedTeamsPreview = "application/vnd.github.hellcat-preview+json" mediaTypeNestedTeamsPreview = "application/vnd.github.hellcat-preview+json"
@ -116,6 +113,9 @@ const (
// https://developer.github.com/changes/2018-02-07-team-discussions-api/ // https://developer.github.com/changes/2018-02-07-team-discussions-api/
mediaTypeTeamDiscussionsPreview = "application/vnd.github.echo-preview+json" mediaTypeTeamDiscussionsPreview = "application/vnd.github.echo-preview+json"
// https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/
mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json"
) )
// A Client manages communication with the GitHub API. // A Client manages communication with the GitHub API.
@ -144,6 +144,7 @@ type Client struct {
Admin *AdminService Admin *AdminService
Apps *AppsService Apps *AppsService
Authorizations *AuthorizationsService Authorizations *AuthorizationsService
Checks *ChecksService
Gists *GistsService Gists *GistsService
Git *GitService Git *GitService
Gitignores *GitignoresService Gitignores *GitignoresService
@ -235,6 +236,7 @@ func NewClient(httpClient *http.Client) *Client {
c.Admin = (*AdminService)(&c.common) c.Admin = (*AdminService)(&c.common)
c.Apps = (*AppsService)(&c.common) c.Apps = (*AppsService)(&c.common)
c.Authorizations = (*AuthorizationsService)(&c.common) c.Authorizations = (*AuthorizationsService)(&c.common)
c.Checks = (*ChecksService)(&c.common)
c.Gists = (*GistsService)(&c.common) c.Gists = (*GistsService)(&c.common)
c.Git = (*GitService)(&c.common) c.Git = (*GitService)(&c.common)
c.Gitignores = (*GitignoresService)(&c.common) c.Gitignores = (*GitignoresService)(&c.common)

View File

@ -41,6 +41,8 @@ const (
var ( var (
// eventTypeMapping maps webhooks types to their corresponding go-github struct types. // eventTypeMapping maps webhooks types to their corresponding go-github struct types.
eventTypeMapping = map[string]string{ eventTypeMapping = map[string]string{
"check_run": "CheckRunEvent",
"check_suite": "CheckSuiteEvent",
"commit_comment": "CommitCommentEvent", "commit_comment": "CommitCommentEvent",
"create": "CreateEvent", "create": "CreateEvent",
"delete": "DeleteEvent", "delete": "DeleteEvent",

View File

@ -0,0 +1,214 @@
// Copyright 2018 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"errors"
"fmt"
"net/http"
)
// UserMigration represents a GitHub migration (archival).
type UserMigration struct {
ID *int64 `json:"id,omitempty"`
GUID *string `json:"guid,omitempty"`
// State is the current state of a migration.
// Possible values are:
// "pending" which means the migration hasn't started yet,
// "exporting" which means the migration is in progress,
// "exported" which means the migration finished successfully, or
// "failed" which means the migration failed.
State *string `json:"state,omitempty"`
// LockRepositories indicates whether repositories are locked (to prevent
// manipulation) while migrating data.
LockRepositories *bool `json:"lock_repositories,omitempty"`
// ExcludeAttachments indicates whether attachments should be excluded from
// the migration (to reduce migration archive file size).
ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
URL *string `json:"url,omitempty"`
CreatedAt *string `json:"created_at,omitempty"`
UpdatedAt *string `json:"updated_at,omitempty"`
Repositories []*Repository `json:"repositories,omitempty"`
}
func (m UserMigration) String() string {
return Stringify(m)
}
// UserMigrationOptions specifies the optional parameters to Migration methods.
type UserMigrationOptions struct {
// LockRepositories indicates whether repositories should be locked (to prevent
// manipulation) while migrating data.
LockRepositories bool
// ExcludeAttachments indicates whether attachments should be excluded from
// the migration (to reduce migration archive file size).
ExcludeAttachments bool
}
// startUserMigration represents the body of a StartMigration request.
type startUserMigration struct {
// Repositories is a slice of repository names to migrate.
Repositories []string `json:"repositories,omitempty"`
// LockRepositories indicates whether repositories should be locked (to prevent
// manipulation) while migrating data.
LockRepositories *bool `json:"lock_repositories,omitempty"`
// ExcludeAttachments indicates whether attachments should be excluded from
// the migration (to reduce migration archive file size).
ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
}
// StartUserMigration starts the generation of a migration archive.
// repos is a slice of repository names to migrate.
//
// GitHub API docs: https://developer.github.com/v3/migrations/users/#start-a-user-migration
func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opt *UserMigrationOptions) (*UserMigration, *Response, error) {
u := "user/migrations"
body := &startUserMigration{Repositories: repos}
if opt != nil {
body.LockRepositories = Bool(opt.LockRepositories)
body.ExcludeAttachments = Bool(opt.ExcludeAttachments)
}
req, err := s.client.NewRequest("POST", u, body)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMigrationsPreview)
m := &UserMigration{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
return nil, resp, err
}
return m, resp, nil
}
// ListUserMigrations lists the most recent migrations.
//
// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-a-list-of-user-migrations
func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) {
u := "user/migrations"
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMigrationsPreview)
var m []*UserMigration
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
return nil, resp, err
}
return m, resp, nil
}
// UserMigrationStatus gets the status of a specific migration archive.
// id is the migration ID.
//
// GitHub API docs: https://developer.github.com/v3/migrations/users/#get-the-status-of-a-user-migration
func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) {
u := fmt.Sprintf("user/migrations/%v", id)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMigrationsPreview)
m := &UserMigration{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
return nil, resp, err
}
return m, resp, nil
}
// UserMigrationArchiveURL gets the URL for a specific migration archive.
// id is the migration ID.
//
// GitHub API docs: https://developer.github.com/v3/migrations/users/#download-a-user-migration-archive
func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) {
url := fmt.Sprintf("user/migrations/%v/archive", id)
req, err := s.client.NewRequest("GET", url, nil)
if err != nil {
return "", err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMigrationsPreview)
m := &UserMigration{}
var loc string
originalRedirect := s.client.client.CheckRedirect
s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
loc = req.URL.String()
return http.ErrUseLastResponse
}
defer func() {
s.client.client.CheckRedirect = originalRedirect
}()
resp, err := s.client.Do(ctx, req, m)
if err == nil {
return "", errors.New("expected redirect, none provided")
}
loc = resp.Header.Get("Location")
return loc, nil
}
// DeleteUserMigration will delete a previous migration archive.
// id is the migration ID.
//
// GitHub API docs: https://developer.github.com/v3/migrations/users/#delete-a-user-migration-archive
func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) {
url := fmt.Sprintf("user/migrations/%v/archive", id)
req, err := s.client.NewRequest("DELETE", url, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMigrationsPreview)
return s.client.Do(ctx, req, nil)
}
// UnlockUserRepository will unlock a repo that was locked for migration.
// id is migration ID.
// You should unlock each migrated repository and delete them when the migration
// is complete and you no longer need the source data.
//
// GitHub API docs: https://developer.github.com/v3/migrations/users/#unlock-a-user-repository
func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) {
url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo)
req, err := s.client.NewRequest("DELETE", url, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeMigrationsPreview)
return s.client.Do(ctx, req, nil)
}

View File

@ -285,15 +285,26 @@ type ProjectCard struct {
CreatedAt *Timestamp `json:"created_at,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"`
NodeID *string `json:"node_id,omitempty"` NodeID *string `json:"node_id,omitempty"`
Archived *bool `json:"archived,omitempty"`
// The following fields are only populated by Webhook events. // The following fields are only populated by Webhook events.
ColumnID *int64 `json:"column_id,omitempty"` ColumnID *int64 `json:"column_id,omitempty"`
} }
// ProjectCardListOptions specifies the optional parameters to the
// ProjectsService.ListProjectCards method.
type ProjectCardListOptions struct {
// ArchivedState is used to list all, archived, or not_archived project cards.
// Defaults to not_archived when you omit this parameter.
ArchivedState *string `url:"archived_state,omitempty"`
ListOptions
}
// ListProjectCards lists the cards in a column of a GitHub Project. // ListProjectCards lists the cards in a column of a GitHub Project.
// //
// GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards // GitHub API docs: https://developer.github.com/v3/projects/cards/#list-project-cards
func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ListOptions) ([]*ProjectCard, *Response, error) { func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opt *ProjectCardListOptions) ([]*ProjectCard, *Response, error) {
u := fmt.Sprintf("projects/columns/%v/cards", columnID) u := fmt.Sprintf("projects/columns/%v/cards", columnID)
u, err := addOptions(u, opt) u, err := addOptions(u, opt)
if err != nil { if err != nil {
@ -352,6 +363,9 @@ type ProjectCardOptions struct {
ContentID int64 `json:"content_id,omitempty"` ContentID int64 `json:"content_id,omitempty"`
// The type of content to associate with this card. Possible values are: "Issue". // The type of content to associate with this card. Possible values are: "Issue".
ContentType string `json:"content_type,omitempty"` ContentType string `json:"content_type,omitempty"`
// Use true to archive a project card.
// Specify false if you need to restore a previously archived project card.
Archived *bool `json:"archived,omitempty"`
} }
// CreateProjectCard creates a card in the specified column of a GitHub Project. // CreateProjectCard creates a card in the specified column of a GitHub Project.

View File

@ -218,7 +218,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re
// CompareCommits compares a range of commits with each other. // CompareCommits compares a range of commits with each other.
// todo: support media formats - https://github.com/google/go-github/issues/6 // todo: support media formats - https://github.com/google/go-github/issues/6
// //
// GitHub API docs: https://developer.github.com/v3/repos/commits/index.html#compare-two-commits // GitHub API docs: https://developer.github.com/v3/repos/commits/#compare-two-commits
func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) { func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string) (*CommitsComparison, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head) u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, base, head)

View File

@ -21,10 +21,12 @@ type Metric struct {
// CommunityHealthFiles represents the different files in the community health metrics response. // CommunityHealthFiles represents the different files in the community health metrics response.
type CommunityHealthFiles struct { type CommunityHealthFiles struct {
CodeOfConduct *Metric `json:"code_of_conduct"` CodeOfConduct *Metric `json:"code_of_conduct"`
Contributing *Metric `json:"contributing"` Contributing *Metric `json:"contributing"`
License *Metric `json:"license"` IssueTemplate *Metric `json:"issue_template"`
Readme *Metric `json:"readme"` PullRequestTemplate *Metric `json:"pull_request_template"`
License *Metric `json:"license"`
Readme *Metric `json:"readme"`
} }
// CommunityHealthMetrics represents a response containing the community metrics of a repository. // CommunityHealthMetrics represents a response containing the community metrics of a repository.

View File

@ -166,16 +166,16 @@ func (a *ansi) Write(text []byte) (int, error) {
red := (colorNumber - 16) / 36 red := (colorNumber - 16) / 36
green := ((colorNumber - 16) / 6) % 6 green := ((colorNumber - 16) / 6) % 6
blue := (colorNumber - 16) % 6 blue := (colorNumber - 16) % 6
color = fmt.Sprintf("%02x%02x%02x", 255*red/5, 255*green/5, 255*blue/5) color = fmt.Sprintf("#%02x%02x%02x", 255*red/5, 255*green/5, 255*blue/5)
} else if colorNumber <= 255 { } else if colorNumber <= 255 {
grey := 255 * (colorNumber - 232) / 23 grey := 255 * (colorNumber - 232) / 23
color = fmt.Sprintf("%02x%02x%02x", grey, grey, grey) color = fmt.Sprintf("#%02x%02x%02x", grey, grey, grey)
} }
} else if fields[index+1] == "2" && len(fields) > index+4 { // 24-bit colors. } else if fields[index+1] == "2" && len(fields) > index+4 { // 24-bit colors.
red, _ := strconv.Atoi(fields[index+2]) red, _ := strconv.Atoi(fields[index+2])
green, _ := strconv.Atoi(fields[index+3]) green, _ := strconv.Atoi(fields[index+3])
blue, _ := strconv.Atoi(fields[index+4]) blue, _ := strconv.Atoi(fields[index+4])
color = fmt.Sprintf("%02x%02x%02x", red, green, blue) color = fmt.Sprintf("#%02x%02x%02x", red, green, blue)
} }
} }
if len(color) > 0 { if len(color) > 0 {

View File

@ -227,13 +227,14 @@ func (a *Application) Suspend(f func()) bool {
// Draw refreshes the screen. It calls the Draw() function of the application's // Draw refreshes the screen. It calls the Draw() function of the application's
// root primitive and then syncs the screen buffer. // root primitive and then syncs the screen buffer.
func (a *Application) Draw() *Application { func (a *Application) Draw() *Application {
a.RLock() a.Lock()
defer a.Unlock()
screen := a.screen screen := a.screen
root := a.root root := a.root
fullscreen := a.rootFullscreen fullscreen := a.rootFullscreen
before := a.beforeDraw before := a.beforeDraw
after := a.afterDraw after := a.afterDraw
a.RUnlock()
// Maybe we're not ready yet or not anymore. // Maybe we're not ready yet or not anymore.
if screen == nil || root == nil { if screen == nil || root == nil {

View File

@ -354,6 +354,7 @@ func (d *DropDown) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr
// Hand control over to the list. // Hand control over to the list.
d.open = true d.open = true
optionBefore := d.currentOption
d.list.SetSelectedFunc(func(index int, mainText, secondaryText string, shortcut rune) { d.list.SetSelectedFunc(func(index int, mainText, secondaryText string, shortcut rune) {
// An option was selected. Close the list again. // An option was selected. Close the list again.
d.open = false d.open = false
@ -374,6 +375,10 @@ func (d *DropDown) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr
d.prefix = string(r[:len(r)-1]) d.prefix = string(r[:len(r)-1])
} }
evalPrefix() evalPrefix()
} else if event.Key() == tcell.KeyEscape {
d.open = false
d.currentOption = optionBefore
setFocus(d)
} else { } else {
d.prefix = "" d.prefix = ""
} }

View File

@ -310,6 +310,12 @@ func (t *TextView) ScrollToEnd() *TextView {
return t return t
} }
// GetScrollOffset returns the number of rows and columns that are skipped at
// the top left corner when the text view has been scrolled.
func (t *TextView) GetScrollOffset() (row, column int) {
return t.lineOffset, t.columnOffset
}
// Clear removes all text from the buffer. // Clear removes all text from the buffer.
func (t *TextView) Clear() *TextView { func (t *TextView) Clear() *TextView {
t.buffer = nil t.buffer = nil

View File

@ -266,6 +266,9 @@ type TreeView struct {
// An optional function which is called when a tree item was selected. // An optional function which is called when a tree item was selected.
selected func(node *TreeNode) selected func(node *TreeNode)
// The visible nodes, top-down, as set by process().
nodes []*TreeNode
} }
// NewTreeView returns a new tree view. // NewTreeView returns a new tree view.
@ -362,17 +365,14 @@ func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView {
return t return t
} }
// Draw draws this primitive onto the screen. // process builds the visible tree, populates the "nodes" slice, and processes
func (t *TreeView) Draw(screen tcell.Screen) { // pending selection actions.
t.Box.Draw(screen) func (t *TreeView) process() {
if t.root == nil { _, _, _, height := t.GetInnerRect()
return
}
x, y, width, height := t.GetInnerRect()
// Determine visible nodes and their placement. // Determine visible nodes and their placement.
var graphicsOffset, maxTextX int var graphicsOffset, maxTextX int
var nodes []*TreeNode t.nodes = nil
selectedIndex := -1 selectedIndex := -1
topLevelGraphicsX := -1 topLevelGraphicsX := -1
if t.graphics { if t.graphics {
@ -403,7 +403,7 @@ func (t *TreeView) Draw(screen tcell.Screen) {
maxTextX = node.textX maxTextX = node.textX
} }
if node == t.currentNode && node.selectable { if node == t.currentNode && node.selectable {
selectedIndex = len(nodes) selectedIndex = len(t.nodes)
} }
// Maybe we want to skip this level. // Maybe we want to skip this level.
@ -413,13 +413,13 @@ func (t *TreeView) Draw(screen tcell.Screen) {
// Add and recurse (if desired). // Add and recurse (if desired).
if node.level >= t.topLevel { if node.level >= t.topLevel {
nodes = append(nodes, node) t.nodes = append(t.nodes, node)
} }
return node.expanded return node.expanded
}) })
// Post-process positions. // Post-process positions.
for _, node := range nodes { for _, node := range t.nodes {
// If text must align, we correct the positions. // If text must align, we correct the positions.
if t.align && node.level > t.topLevel { if t.align && node.level > t.topLevel {
node.textX = maxTextX node.textX = maxTextX
@ -441,41 +441,41 @@ func (t *TreeView) Draw(screen tcell.Screen) {
case treeUp: case treeUp:
for newSelectedIndex > 0 { for newSelectedIndex > 0 {
newSelectedIndex-- newSelectedIndex--
if nodes[newSelectedIndex].selectable { if t.nodes[newSelectedIndex].selectable {
break MovementSwitch break MovementSwitch
} }
} }
newSelectedIndex = selectedIndex newSelectedIndex = selectedIndex
case treeDown: case treeDown:
for newSelectedIndex < len(nodes)-1 { for newSelectedIndex < len(t.nodes)-1 {
newSelectedIndex++ newSelectedIndex++
if nodes[newSelectedIndex].selectable { if t.nodes[newSelectedIndex].selectable {
break MovementSwitch break MovementSwitch
} }
} }
newSelectedIndex = selectedIndex newSelectedIndex = selectedIndex
case treeHome: case treeHome:
for newSelectedIndex = 0; newSelectedIndex < len(nodes); newSelectedIndex++ { for newSelectedIndex = 0; newSelectedIndex < len(t.nodes); newSelectedIndex++ {
if nodes[newSelectedIndex].selectable { if t.nodes[newSelectedIndex].selectable {
break MovementSwitch break MovementSwitch
} }
} }
newSelectedIndex = selectedIndex newSelectedIndex = selectedIndex
case treeEnd: case treeEnd:
for newSelectedIndex = len(nodes) - 1; newSelectedIndex >= 0; newSelectedIndex-- { for newSelectedIndex = len(t.nodes) - 1; newSelectedIndex >= 0; newSelectedIndex-- {
if nodes[newSelectedIndex].selectable { if t.nodes[newSelectedIndex].selectable {
break MovementSwitch break MovementSwitch
} }
} }
newSelectedIndex = selectedIndex newSelectedIndex = selectedIndex
case treePageUp: case treePageUp:
if newSelectedIndex+height < len(nodes) { if newSelectedIndex+height < len(t.nodes) {
newSelectedIndex += height newSelectedIndex += height
} else { } else {
newSelectedIndex = len(nodes) - 1 newSelectedIndex = len(t.nodes) - 1
} }
for ; newSelectedIndex < len(nodes); newSelectedIndex++ { for ; newSelectedIndex < len(t.nodes); newSelectedIndex++ {
if nodes[newSelectedIndex].selectable { if t.nodes[newSelectedIndex].selectable {
break MovementSwitch break MovementSwitch
} }
} }
@ -487,13 +487,13 @@ func (t *TreeView) Draw(screen tcell.Screen) {
newSelectedIndex = 0 newSelectedIndex = 0
} }
for ; newSelectedIndex >= 0; newSelectedIndex-- { for ; newSelectedIndex >= 0; newSelectedIndex-- {
if nodes[newSelectedIndex].selectable { if t.nodes[newSelectedIndex].selectable {
break MovementSwitch break MovementSwitch
} }
} }
newSelectedIndex = selectedIndex newSelectedIndex = selectedIndex
} }
t.currentNode = nodes[newSelectedIndex] t.currentNode = t.nodes[newSelectedIndex]
if newSelectedIndex != selectedIndex { if newSelectedIndex != selectedIndex {
t.movement = treeNone t.movement = treeNone
if t.changed != nil { if t.changed != nil {
@ -512,7 +512,7 @@ func (t *TreeView) Draw(screen tcell.Screen) {
} else { } else {
// If selection is not visible or selectable, select the first candidate. // If selection is not visible or selectable, select the first candidate.
if t.currentNode != nil { if t.currentNode != nil {
for index, node := range nodes { for index, node := range t.nodes {
if node.selectable { if node.selectable {
selectedIndex = index selectedIndex = index
t.currentNode = node t.currentNode = node
@ -524,8 +524,25 @@ func (t *TreeView) Draw(screen tcell.Screen) {
t.currentNode = nil t.currentNode = nil
} }
} }
}
// Draw draws this primitive onto the screen.
func (t *TreeView) Draw(screen tcell.Screen) {
t.Box.Draw(screen)
if t.root == nil {
return
}
// Build the tree if necessary.
if t.nodes == nil {
t.process()
}
defer func() {
t.nodes = nil // Rebuild during next call to Draw()
}()
// Scroll the tree. // Scroll the tree.
x, y, width, height := t.GetInnerRect()
switch t.movement { switch t.movement {
case treeUp: case treeUp:
t.offsetY-- t.offsetY--
@ -534,7 +551,7 @@ func (t *TreeView) Draw(screen tcell.Screen) {
case treeHome: case treeHome:
t.offsetY = 0 t.offsetY = 0
case treeEnd: case treeEnd:
t.offsetY = len(nodes) t.offsetY = len(t.nodes)
case treePageUp: case treePageUp:
t.offsetY -= height t.offsetY -= height
case treePageDown: case treePageDown:
@ -543,8 +560,8 @@ func (t *TreeView) Draw(screen tcell.Screen) {
t.movement = treeNone t.movement = treeNone
// Fix invalid offsets. // Fix invalid offsets.
if t.offsetY >= len(nodes)-height { if t.offsetY >= len(t.nodes)-height {
t.offsetY = len(nodes) - height t.offsetY = len(t.nodes) - height
} }
if t.offsetY < 0 { if t.offsetY < 0 {
t.offsetY = 0 t.offsetY = 0
@ -553,7 +570,7 @@ func (t *TreeView) Draw(screen tcell.Screen) {
// Draw the tree. // Draw the tree.
posY := y posY := y
lineStyle := tcell.StyleDefault.Foreground(t.graphicsColor) lineStyle := tcell.StyleDefault.Foreground(t.graphicsColor)
for index, node := range nodes { for index, node := range t.nodes {
// Skip invisible parts. // Skip invisible parts.
if posY >= y+height+1 { if posY >= y+height+1 {
break break
@ -585,7 +602,7 @@ func (t *TreeView) Draw(screen tcell.Screen) {
if node.textX > node.graphicsX && node.graphicsX < width { if node.textX > node.graphicsX && node.graphicsX < width {
// Connect to the node above. // Connect to the node above.
if posY-1 >= y && nodes[index-1].graphicsX <= node.graphicsX && nodes[index-1].textX > node.graphicsX { if posY-1 >= y && t.nodes[index-1].graphicsX <= node.graphicsX && t.nodes[index-1].textX > node.graphicsX {
PrintJoinedSemigraphics(screen, x+node.graphicsX, posY-1, Borders.TopLeft, t.graphicsColor) PrintJoinedSemigraphics(screen, x+node.graphicsX, posY-1, Borders.TopLeft, t.graphicsColor)
} }
@ -610,7 +627,7 @@ func (t *TreeView) Draw(screen tcell.Screen) {
// Text. // Text.
if node.textX+prefixWidth < width { if node.textX+prefixWidth < width {
style := tcell.StyleDefault.Foreground(node.color) style := tcell.StyleDefault.Foreground(node.color)
if index == selectedIndex { if node == t.currentNode {
style = tcell.StyleDefault.Background(node.color).Foreground(t.backgroundColor) style = tcell.StyleDefault.Background(node.color).Foreground(t.backgroundColor)
} }
printWithStyle(screen, node.text, x+node.textX+prefixWidth, posY, width-node.textX-prefixWidth, AlignLeft, style) printWithStyle(screen, node.text, x+node.textX+prefixWidth, posY, width-node.textX-prefixWidth, AlignLeft, style)
@ -661,5 +678,7 @@ func (t *TreeView) InputHandler() func(event *tcell.EventKey, setFocus func(p Pr
} }
} }
} }
t.process()
}) })
} }

View File

@ -6,6 +6,7 @@
# Folders # Folders
_obj _obj
_test _test
.idea
# Architecture specific extensions/prefixes # Architecture specific extensions/prefixes
*.[568vq] *.[568vq]

View File

@ -68,11 +68,12 @@ func (c Commit) String() string {
// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits
type ListCommitsOptions struct { type ListCommitsOptions struct {
ListOptions ListOptions
RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"` RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
Since *time.Time `url:"since,omitempty" json:"since,omitempty"` Since *time.Time `url:"since,omitempty" json:"since,omitempty"`
Until *time.Time `url:"until,omitempty" json:"until,omitempty"` Until *time.Time `url:"until,omitempty" json:"until,omitempty"`
Path *string `url:"path,omitempty" json:"path,omitempty"` Path *string `url:"path,omitempty" json:"path,omitempty"`
All *bool `url:"all,omitempty" json:"all,omitempty"` All *bool `url:"all,omitempty" json:"all,omitempty"`
WithStats *bool `url:"with_stats,omitempty" json:"with_stats,omitempty"`
} }
// ListCommits gets a list of repository commits in a project. // ListCommits gets a list of repository commits in a project.
@ -121,6 +122,49 @@ type CommitAction struct {
Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"` Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
} }
// CommitRef represents the reference of branches/tags in a commit.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
type CommitRef struct {
Type string `json:"type"`
Name string `json:"name"`
}
// GetCommitRefsOptions represents the available GetCommitRefs() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
type GetCommitRefsOptions struct {
ListOptions
Type *string `url:"type,omitempty" json:"type,omitempty"`
}
// GetCommitRefs gets all references (from branches or tags) a commit is pushed to
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]CommitRef, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", url.QueryEscape(project), sha)
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
}
var cs []CommitRef
resp, err := s.client.Do(req, &cs)
if err != nil {
return nil, resp, err
}
return cs, resp, err
}
// GetCommit gets a specific commit identified by the commit hash or name of a // GetCommit gets a specific commit identified by the commit hash or name of a
// branch or tag. // branch or tag.
// //

View File

@ -55,7 +55,11 @@ func (t Tag) String() string {
// //
// GitLab API docs: // GitLab API docs:
// https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags // https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags
type ListTagsOptions ListOptions type ListTagsOptions struct {
ListOptions
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
}
// ListTags gets a list of tags from a project, sorted by name in reverse // ListTags gets a list of tags from a project, sorted by name in reverse
// alphabetical order. // alphabetical order.

View File

@ -17,7 +17,7 @@
"description": "Manipulates events and other calendar data.", "description": "Manipulates events and other calendar data.",
"discoveryVersion": "v1", "discoveryVersion": "v1",
"documentationLink": "https://developers.google.com/google-apps/calendar/firstapp", "documentationLink": "https://developers.google.com/google-apps/calendar/firstapp",
"etag": "\"Zkyw9ACJZUvcYmlFaKGChzhmtnE/1VOFhc7FcQH_8hh6rAZ7o3yjhp8\"", "etag": "\"J3WqvAcMk4eQjJXvfSI4Yr8VouA/ITK5FY7POTu4MHcI4-Fs0HUENwM\"",
"icons": { "icons": {
"x16": "http://www.google.com/images/icons/product/calendar-16.png", "x16": "http://www.google.com/images/icons/product/calendar-16.png",
"x32": "http://www.google.com/images/icons/product/calendar-32.png" "x32": "http://www.google.com/images/icons/product/calendar-32.png"
@ -1604,7 +1604,6 @@
} }
} }
}, },
"revision": "20180424",
"rootUrl": "https://www.googleapis.com/", "rootUrl": "https://www.googleapis.com/",
"schemas": { "schemas": {
"Acl": { "Acl": {
@ -2465,7 +2464,7 @@
"description": "The (inclusive) start time of the event. For a recurring event, this is the start time of the first instance." "description": "The (inclusive) start time of the event. For a recurring event, this is the start time of the first instance."
}, },
"status": { "status": {
"description": "Status of the event. Optional. Possible values are: \n- \"confirmed\" - The event is confirmed. This is the default status. \n- \"tentative\" - The event is tentatively confirmed. \n- \"cancelled\" - The event is cancelled.", "description": "Status of the event. Optional. Possible values are: \n- \"confirmed\" - The event is confirmed. This is the default status. \n- \"tentative\" - The event is tentatively confirmed. \n- \"cancelled\" - The event is cancelled (deleted). The list method returns cancelled events only on incremental sync (when syncToken or updatedMin are specified) or if the showDeleted flag is set to true. The get method always returns them.\nA cancelled status represents two different states depending on the event type: \n- Cancelled exceptions of an uncancelled recurring event indicate that this instance should no longer be presented to the user. Clients should store these events for the lifetime of the parent recurring event.\nCancelled exceptions are only guaranteed to have values for the id, recurringEventId and originalStartTime fields populated. The other fields might be empty. \n- All other cancelled events represent deleted events. Clients should remove their locally synced copies. Such cancelled events will eventually disappear, so do not rely on them being available indefinitely.\nDeleted events are only guaranteed to have the id field populated. On the organizer's calendar, cancelled events continue to expose event details (summary, location, etc.) so that they can be restored (undeleted). Similarly, the events to which the user was invited and that they manually removed continue to provide details. However, incremental sync requests with showDeleted set to false will not return these details.\nIf an event changes its organizer (for example via the move operation) and the original organizer is not on the attendee list, it will leave behind a cancelled event where only the id field is guaranteed to be populated.",
"type": "string" "type": "string"
}, },
"summary": { "summary": {

View File

@ -1375,7 +1375,34 @@ type Event struct {
// - "confirmed" - The event is confirmed. This is the default status. // - "confirmed" - The event is confirmed. This is the default status.
// //
// - "tentative" - The event is tentatively confirmed. // - "tentative" - The event is tentatively confirmed.
// - "cancelled" - The event is cancelled. // - "cancelled" - The event is cancelled (deleted). The list method
// returns cancelled events only on incremental sync (when syncToken or
// updatedMin are specified) or if the showDeleted flag is set to true.
// The get method always returns them.
// A cancelled status represents two different states depending on the
// event type:
// - Cancelled exceptions of an uncancelled recurring event indicate
// that this instance should no longer be presented to the user. Clients
// should store these events for the lifetime of the parent recurring
// event.
// Cancelled exceptions are only guaranteed to have values for the id,
// recurringEventId and originalStartTime fields populated. The other
// fields might be empty.
// - All other cancelled events represent deleted events. Clients should
// remove their locally synced copies. Such cancelled events will
// eventually disappear, so do not rely on them being available
// indefinitely.
// Deleted events are only guaranteed to have the id field populated.
// On the organizer's calendar, cancelled events continue to expose
// event details (summary, location, etc.) so that they can be restored
// (undeleted). Similarly, the events to which the user was invited and
// that they manually removed continue to provide details. However,
// incremental sync requests with showDeleted set to false will not
// return these details.
// If an event changes its organizer (for example via the move
// operation) and the original organizer is not on the attendee list, it
// will leave behind a cancelled event where only the id field is
// guaranteed to be populated.
Status string `json:"status,omitempty"` Status string `json:"status,omitempty"`
// Summary: Title of the event. // Summary: Title of the event.

View File

@ -28,6 +28,7 @@ var weatherEmoji = map[string]string{
"partly cloudy": "🌤", "partly cloudy": "🌤",
"scattered clouds": "🌤", "scattered clouds": "🌤",
"shower rain": "☔️", "shower rain": "☔️",
"smoke": "🔥",
"snow": "❄️", "snow": "❄️",
"sunny": "☀️", "sunny": "☀️",
"thunderstorm": "⛈", "thunderstorm": "⛈",

View File

@ -42,6 +42,10 @@ func (tracker *FocusTracker) FocusOn(char string) bool {
return false return false
} }
if tracker.focusState() == AppBoard {
return false
}
hasFocusable := false hasFocusable := false
for idx, focusable := range tracker.focusables() { for idx, focusable := range tracker.focusables() {