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

Merge branch 'bosr-fix/glog'

This commit is contained in:
Chris Cummer 2019-05-19 20:11:48 -07:00
commit 5bd6b26a60
8 changed files with 30 additions and 27 deletions

1
go.mod
View File

@ -30,7 +30,6 @@ require (
github.com/go-test/deep v1.0.1 // indirect github.com/go-test/deep v1.0.1 // indirect
github.com/godbus/dbus v5.0.1+incompatible github.com/godbus/dbus v5.0.1+incompatible
github.com/gogo/protobuf v1.2.1 // indirect github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/glog v0.0.0-20170312005925-543a34c32e4d // indirect
github.com/golang/mock v1.3.1 // indirect github.com/golang/mock v1.3.1 // indirect
github.com/golang/protobuf v1.3.1 github.com/golang/protobuf v1.3.1
github.com/google/btree v1.0.0 // indirect github.com/google/btree v1.0.0 // indirect

View File

@ -4,11 +4,11 @@ import "github.com/gdamore/tcell"
func (widget *Widget) initializeKeyboardControls() { func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help window") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help window")
widget.SetKeyboardChar("h", widget.Prev, "Select previous item") widget.SetKeyboardChar("h", widget.PrevSource, "Select previous item")
widget.SetKeyboardChar("l", widget.Next, "Select next item") widget.SetKeyboardChar("l", widget.NextSource, "Select next item")
widget.SetKeyboardChar("p", widget.Pull, "Pull repo") widget.SetKeyboardChar("p", widget.Pull, "Pull repo")
widget.SetKeyboardChar("c", widget.Checkout, "Checkout branch") widget.SetKeyboardChar("c", widget.Checkout, "Checkout branch")
widget.SetKeyboardKey(tcell.KeyLeft, widget.Prev, "Select previous item") widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous item")
widget.SetKeyboardKey(tcell.KeyRight, widget.Next, "Select next item") widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next item")
} }

View File

@ -6,12 +6,12 @@ import (
func (widget *Widget) initializeKeyboardControls() { func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar("h", widget.Prev, "Select previous item") widget.SetKeyboardChar("h", widget.PrevSource, "Select previous item")
widget.SetKeyboardChar("l", widget.Next, "Select next item") widget.SetKeyboardChar("l", widget.NextSource, "Select next item")
widget.SetKeyboardChar("o", widget.openRepo, "Open item in browser") widget.SetKeyboardChar("o", widget.openRepo, "Open item in browser")
widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget") widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget")
widget.SetKeyboardKey(tcell.KeyEnter, widget.openRepo, "Open item in browser") widget.SetKeyboardKey(tcell.KeyEnter, widget.openRepo, "Open item in browser")
widget.SetKeyboardKey(tcell.KeyLeft, widget.Prev, "Select previous item") widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous item")
widget.SetKeyboardKey(tcell.KeyRight, widget.Next, "Select next item") widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next item")
} }

View File

@ -4,11 +4,11 @@ import "github.com/gdamore/tcell"
func (widget *Widget) initializeKeyboardControls() { func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar("h", widget.Prev, "Select previous item") widget.SetKeyboardChar("h", widget.PrevSource, "Select previous item")
widget.SetKeyboardChar("l", widget.Next, "Select next item") widget.SetKeyboardChar("l", widget.NextSource, "Select next item")
widget.SetKeyboardChar("p", widget.Pull, "Pull repo") widget.SetKeyboardChar("p", widget.Pull, "Pull repo")
widget.SetKeyboardChar("c", widget.Checkout, "Checkout branch") widget.SetKeyboardChar("c", widget.Checkout, "Checkout branch")
widget.SetKeyboardKey(tcell.KeyLeft, widget.Prev, "Select previous item") widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous item")
widget.SetKeyboardKey(tcell.KeyRight, widget.Next, "Select next item") widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next item")
} }

View File

@ -7,12 +7,12 @@ import (
func (widget *Widget) initializeKeyboardControls() { func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar("h", widget.Prev, "Select previous item") widget.SetKeyboardChar("h", widget.PrevSource, "Select previous item")
widget.SetKeyboardChar("l", widget.Next, "Select next item") widget.SetKeyboardChar("l", widget.NextSource, "Select next item")
widget.SetKeyboardChar("o", widget.openFile, "Open item") widget.SetKeyboardChar("o", widget.openFile, "Open item")
widget.SetKeyboardKey(tcell.KeyLeft, widget.Prev, "Select previous item") widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous item")
widget.SetKeyboardKey(tcell.KeyRight, widget.Next, "Select next item") widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next item")
} }
func (widget *Widget) openFile() { func (widget *Widget) openFile() {

View File

@ -6,14 +6,14 @@ func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar("c", widget.Close, "Close item") widget.SetKeyboardChar("c", widget.Close, "Close item")
widget.SetKeyboardChar("d", widget.Delete, "Delete item") widget.SetKeyboardChar("d", widget.Delete, "Delete item")
widget.SetKeyboardChar("h", widget.Prev, "Select previous project") widget.SetKeyboardChar("h", widget.PrevSource, "Select previous project")
widget.SetKeyboardChar("j", widget.Up, "Select previous item") widget.SetKeyboardChar("j", widget.Up, "Select previous item")
widget.SetKeyboardChar("k", widget.Down, "Select next item") widget.SetKeyboardChar("k", widget.Down, "Select next item")
widget.SetKeyboardChar("l", widget.Next, "Select next project") widget.SetKeyboardChar("l", widget.NextSource, "Select next project")
widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget") widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget")
widget.SetKeyboardKey(tcell.KeyDown, widget.Down, "Select next item") widget.SetKeyboardKey(tcell.KeyDown, widget.Down, "Select next item")
widget.SetKeyboardKey(tcell.KeyLeft, widget.Prev, "Select previous project") widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous project")
widget.SetKeyboardKey(tcell.KeyRight, widget.Next, "Select next project") widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next project")
widget.SetKeyboardKey(tcell.KeyUp, widget.Up, "Select previous item") widget.SetKeyboardKey(tcell.KeyUp, widget.Up, "Select previous item")
} }

View File

@ -7,13 +7,13 @@ import (
func (widget *Widget) initializeKeyboardControls() { func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar("h", widget.Prev, "Select previous item") widget.SetKeyboardChar("h", widget.PrevSource, "Select previous item")
widget.SetKeyboardChar("l", widget.Next, "Select next item") widget.SetKeyboardChar("l", widget.NextSource, "Select next item")
widget.SetKeyboardChar("o", widget.openFile, "Open item") widget.SetKeyboardChar("o", widget.openFile, "Open item")
widget.SetKeyboardKey(tcell.KeyEnter, widget.openFile, "Open item") widget.SetKeyboardKey(tcell.KeyEnter, widget.openFile, "Open item")
widget.SetKeyboardKey(tcell.KeyLeft, widget.Prev, "Select previous item") widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous item")
widget.SetKeyboardKey(tcell.KeyRight, widget.Next, "Select next item") widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next item")
} }
func (widget *Widget) openFile() { func (widget *Widget) openFile() {

View File

@ -1,7 +1,9 @@
package wtf package wtf
import ( import (
"fmt"
"github.com/wtfutil/wtf/cfg" "github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/logger"
) )
type MultiSourceWidget struct { type MultiSourceWidget struct {
@ -24,6 +26,8 @@ func NewMultiSourceWidget(moduleConfig *cfg.Common, singular, plural string) Mul
widget.loadSources() widget.loadSources()
logger.Log(fmt.Sprintf("%+v", widget.Sources))
return widget return widget
} }
@ -40,7 +44,7 @@ func (widget *MultiSourceWidget) CurrentSource() string {
// Next displays the next source in the source list. If the current source is the last // Next displays the next source in the source list. If the current source is the last
// source it wraps around to the first source // source it wraps around to the first source
func (widget *MultiSourceWidget) Next() { func (widget *MultiSourceWidget) NextSource() {
widget.Idx = widget.Idx + 1 widget.Idx = widget.Idx + 1
if widget.Idx == len(widget.Sources) { if widget.Idx == len(widget.Sources) {
widget.Idx = 0 widget.Idx = 0
@ -53,7 +57,7 @@ func (widget *MultiSourceWidget) Next() {
// Prev displays the previous source in the source list. If the current source is the first // Prev displays the previous source in the source list. If the current source is the first
// source, it wraps around to the last source // source, it wraps around to the last source
func (widget *MultiSourceWidget) Prev() { func (widget *MultiSourceWidget) PrevSource() {
widget.Idx = widget.Idx - 1 widget.Idx = widget.Idx - 1
if widget.Idx < 0 { if widget.Idx < 0 {
widget.Idx = len(widget.Sources) - 1 widget.Idx = len(widget.Sources) - 1