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

Merge branch 'master' into master

This commit is contained in:
Chris Cummer 2018-06-14 16:33:57 -07:00 committed by GitHub
commit b04d444e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 13 deletions

View File

@ -1,13 +1,11 @@
BRANCH := `git rev-parse --abbrev-ref HEAD`
.PHONY: dependencies install run .PHONY: dependencies install run
build: build:
go build -o bin/wtf go build -o bin/wtf
install: install:
which wtf | xargs rm || true go clean
go install -ldflags="-X main.version=$(shell git describe --always --abbrev=6)_$(BRANCH) -X main.date=$(shell date +%FT%T%z)" go install -ldflags="-X main.version=$(shell git describe --always --abbrev=6) -X main.date=$(shell date +%FT%T%z)"
which wtf which wtf
run: build run: build

View File

@ -45,6 +45,7 @@ jira:
project: "ProjectA" project: "ProjectA"
refreshInterval: 900 refreshInterval: 900
username: "chris.cummer" username: "chris.cummer"
verifyServerCertificate: true
``` ```
### Multiple Jira Projects ### Multiple Jira Projects
@ -70,6 +71,7 @@ jira:
project: ["ProjectA", "ProjectB"] project: ["ProjectA", "ProjectB"]
refreshInterval: 900 refreshInterval: 900
username: "chris.cummer" username: "chris.cummer"
verifyServerCertificate: true
``` ```
### Attributes ### Attributes
@ -113,3 +115,8 @@ Values: A positive integer, `0..n`.
`username` <br /> `username` <br />
Your Jira username. <br /> Your Jira username. <br />
`verifyServerCertificate` <br />
_Optional_ <br />
Determines whether or not the server's certificate chain and host name are verified. <br />
Values: `true`, `false`.

View File

@ -36,14 +36,16 @@ func NewWidget() *Widget {
func (widget *Widget) Refresh() { func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt() widget.UpdateRefreshedAt()
widget.execute() widget.execute()
widget.View.SetTitle(fmt.Sprintf(" %s ", widget))
title := Config.UString("wtf.mods.cmdrunner.title", widget.String())
widget.View.SetTitle(fmt.Sprintf("%s", title))
widget.View.SetText(fmt.Sprintf("%s", widget.result)) widget.View.SetText(fmt.Sprintf("%s", widget.result))
} }
func (widget *Widget) String() string { func (widget *Widget) String() string {
args := strings.Join(widget.args, " ") args := strings.Join(widget.args, " ")
return fmt.Sprintf("%s %s", widget.cmd, args) return fmt.Sprintf(" %s %s ", widget.cmd, args)
} }
func (widget *Widget) execute() { func (widget *Widget) execute() {

View File

@ -266,8 +266,8 @@ Key: j Action: Select the next item in the list.</description>
<description>Displays all Jira issues assigned to you for the specified project. <description>Displays all Jira issues assigned to you for the specified project.
Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key. Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key.
Keyboard Commands None. Keyboard Commands None.
Configuration Single Jira Project jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:&amp;#34;ProjectA&amp;#34;refreshInterval:900username:&amp;#34;chris.cummer&amp;#34; Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project): Configuration Single Jira Project jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:&amp;#34;ProjectA&amp;#34;refreshInterval:900username:&amp;#34;chris.cummer&amp;#34;verifyServerCertificate:true Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project):
jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:[&amp;#34;ProjectA&amp;#34;,&amp;#34;ProjectB&amp;#34;]refreshInterval:900username:&amp;#34;chris.cummer&amp;#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.</description> jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:[&amp;#34;ProjectA&amp;#34;,&amp;#34;ProjectB&amp;#34;]refreshInterval:900username:&amp;#34;chris.cummer&amp;#34;verifyServerCertificate:true Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.</description>
</item> </item>
<item> <item>

View File

@ -266,8 +266,8 @@ Key: j Action: Select the next item in the list.</description>
<description>Displays all Jira issues assigned to you for the specified project. <description>Displays all Jira issues assigned to you for the specified project.
Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key. Source Code wtf/jira/ Required ENV Variables Key: WTF_JIRA_API_KEY Value: Your Jira API key.
Keyboard Commands None. Keyboard Commands None.
Configuration Single Jira Project jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:&amp;#34;ProjectA&amp;#34;refreshInterval:900username:&amp;#34;chris.cummer&amp;#34; Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project): Configuration Single Jira Project jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:&amp;#34;ProjectA&amp;#34;refreshInterval:900username:&amp;#34;chris.cummer&amp;#34;verifyServerCertificate:true Multiple Jira Projects If you want to monitor multiple Jira projects, use the following configuration (note the difference in project):
jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:[&amp;#34;ProjectA&amp;#34;,&amp;#34;ProjectB&amp;#34;]refreshInterval:900username:&amp;#34;chris.cummer&amp;#34; Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.</description> jira:colors:rows:even:&amp;#34;lightblue&amp;#34;odd:&amp;#34;white&amp;#34;domain:&amp;#34;https://umbrellacorp.atlassian.net&amp;#34;email:&amp;#34;chriscummer@me.com&amp;#34;enabled:truejql:&amp;#34;issueType = Story&amp;#34;position:top:4left:1height:1width:2project:[&amp;#34;ProjectA&amp;#34;,&amp;#34;ProjectB&amp;#34;]refreshInterval:900username:&amp;#34;chris.cummer&amp;#34;verifyServerCertificate:true Attributes colors.rows.even Define the foreground color for even-numbered rows. Values: Any X11 color name.</description>
</item> </item>
<item> <item>

View File

@ -153,7 +153,8 @@
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w"> </span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
</span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="s2">&#34;ProjectA&#34;</span><span class="w"> </span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="s2">&#34;ProjectA&#34;</span><span class="w">
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span><span class="w"> </span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span><span class="w">
</span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">&#34;chris.cummer&#34;</span></code></pre></div> </span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">&#34;chris.cummer&#34;</span><span class="w">
</span><span class="w"> </span>verifyServerCertificate<span class="p">:</span><span class="w"> </span><span class="kc">true</span></code></pre></div>
<h3 id="multiple-jira-projects">Multiple Jira Projects</h3> <h3 id="multiple-jira-projects">Multiple Jira Projects</h3>
<p>If you want to monitor multiple Jira projects, use the following <p>If you want to monitor multiple Jira projects, use the following
@ -174,7 +175,8 @@ configuration (note the difference in <code>project</code>):</p>
</span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w"> </span><span class="w"> </span>width<span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
</span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&#34;ProjectA&#34;</span><span class="p">,</span><span class="w"> </span><span class="s2">&#34;ProjectB&#34;</span><span class="p">]</span><span class="w"> </span><span class="w"> </span>project<span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&#34;ProjectA&#34;</span><span class="p">,</span><span class="w"> </span><span class="s2">&#34;ProjectB&#34;</span><span class="p">]</span><span class="w">
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span><span class="w"> </span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">900</span><span class="w">
</span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">&#34;chris.cummer&#34;</span></code></pre></div> </span><span class="w"> </span>username<span class="p">:</span><span class="w"> </span><span class="s2">&#34;chris.cummer&#34;</span><span class="w">
</span><span class="w"> </span>verifyServerCertificate<span class="p">:</span><span class="w"> </span><span class="kc">true</span></code></pre></div>
<h3 id="attributes">Attributes</h3> <h3 id="attributes">Attributes</h3>
<p><code>colors.rows.even</code> <br /> <p><code>colors.rows.even</code> <br />
@ -217,6 +219,11 @@ Values: A positive integer, <code>0..n</code>.</p>
<p><code>username</code> <br /> <p><code>username</code> <br />
Your Jira username. <br /></p> Your Jira username. <br /></p>
<p><code>verifyServerCertificate</code> <br />
<em>Optional</em> <br />
Determines whether or not the server&rsquo;s certificate chain and host name are verified. <br />
Values: <code>true</code>, <code>false</code>.</p>
</div> </div>
<div class="footer"> <div class="footer">

View File

@ -2,6 +2,7 @@ package jira
import ( import (
"bytes" "bytes"
"crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@ -60,7 +61,13 @@ func jiraRequest(path string) (*http.Response, error) {
} }
req.SetBasicAuth(Config.UString("wtf.mods.jira.email"), os.Getenv("WTF_JIRA_API_KEY")) req.SetBasicAuth(Config.UString("wtf.mods.jira.email"), os.Getenv("WTF_JIRA_API_KEY"))
httpClient := &http.Client{} verifyServerCertificate := Config.UBool("wtf.mods.jira.verifyServerCertificate", true)
httpClient := &http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: !verifyServerCertificate,
},
},
}
resp, err := httpClient.Do(req) resp, err := httpClient.Do(req)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -36,6 +36,10 @@ func (tracker *FocusTracker) Next() {
// None removes focus from the currently-focused widget. // None removes focus from the currently-focused widget.
func (tracker *FocusTracker) None() { func (tracker *FocusTracker) None() {
if tracker.focusState() == NonWidget {
return
}
tracker.blur(tracker.Idx) tracker.blur(tracker.Idx)
} }