gofmt autofix paths
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
47a665be8b
commit
ff3a51f354
28
common.go
28
common.go
|
@ -8,7 +8,9 @@ import (
|
|||
// reports externally if something has changed
|
||||
// since the last time it was asked about it
|
||||
func (rs *RepoStatus) Changed() bool {
|
||||
if ! rs.Ready() {return false}
|
||||
if !rs.Ready() {
|
||||
return false
|
||||
}
|
||||
if rs.changed {
|
||||
rs.changed = false
|
||||
return true
|
||||
|
@ -17,7 +19,9 @@ func (rs *RepoStatus) Changed() bool {
|
|||
}
|
||||
|
||||
func (rs *RepoStatus) Draw() {
|
||||
if ! rs.Ready() {return}
|
||||
if !rs.Ready() {
|
||||
return
|
||||
}
|
||||
log.Log(CHANGE, "Draw() window ready =", rs.ready)
|
||||
rs.window.TestDraw()
|
||||
// rs.window.Draw()
|
||||
|
@ -25,21 +29,27 @@ func (rs *RepoStatus) Draw() {
|
|||
}
|
||||
|
||||
func (rs *RepoStatus) Show() {
|
||||
if ! rs.Ready() {return}
|
||||
if !rs.Ready() {
|
||||
return
|
||||
}
|
||||
log.Log(CHANGE, "Show() window ready =", rs.ready)
|
||||
rs.window.Show()
|
||||
rs.hidden = false
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) Hide() {
|
||||
if ! rs.Ready() {return}
|
||||
if !rs.Ready() {
|
||||
return
|
||||
}
|
||||
log.Log(CHANGE, "Hide() window ready =", rs.ready)
|
||||
rs.window.Hide()
|
||||
rs.hidden = true
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) Toggle() {
|
||||
if ! rs.Ready() {return}
|
||||
if !rs.Ready() {
|
||||
return
|
||||
}
|
||||
log.Log(CHANGE, "Toggle() window ready =", rs.ready)
|
||||
if rs.hidden {
|
||||
rs.Show()
|
||||
|
@ -50,8 +60,12 @@ func (rs *RepoStatus) Toggle() {
|
|||
|
||||
func (rs *RepoStatus) Ready() bool {
|
||||
log.Log(SPEW, "Ready() maybe not ready? rs =", rs)
|
||||
if rs == nil {return false}
|
||||
if rs.window == nil {return false}
|
||||
if rs == nil {
|
||||
return false
|
||||
}
|
||||
if rs.window == nil {
|
||||
return false
|
||||
}
|
||||
return rs.ready
|
||||
}
|
||||
|
||||
|
|
10
draw.go
10
draw.go
|
@ -4,16 +4,18 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui/widget"
|
||||
"go.wit.com/gui/gadgets"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/widget"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// creates the actual widgets.
|
||||
// it's assumed you are always passing in a box
|
||||
func (rs *RepoStatus) draw() {
|
||||
if ! rs.Ready() {return}
|
||||
if !rs.Ready() {
|
||||
return
|
||||
}
|
||||
|
||||
// display the status of the git repository
|
||||
rs.drawGitStatus()
|
||||
|
|
2
git.go
2
git.go
|
@ -4,8 +4,8 @@ import (
|
|||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"io/ioutil"
|
||||
"go.wit.com/log"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func (rs *RepoStatus) GetPath() string {
|
||||
|
|
4
new.go
4
new.go
|
@ -1,9 +1,9 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui/gadgets"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func New(p *gui.Node, path string) *RepoStatus {
|
||||
|
|
|
@ -2,7 +2,7 @@ package repostatus
|
|||
|
||||
import (
|
||||
"go.wit.com/gui/gui"
|
||||
"go.wit.com/gui/gadgets"
|
||||
"go.wit.com/lib/gadgets"
|
||||
)
|
||||
|
||||
type RepoStatus struct {
|
||||
|
|
4
timer.go
4
timer.go
|
@ -12,6 +12,8 @@ func timeFunction(f func()) time.Duration {
|
|||
}
|
||||
|
||||
func (ls *RepoStatus) SetSpeedActual(s string) {
|
||||
if ! ls.Ready() {return}
|
||||
if !ls.Ready() {
|
||||
return
|
||||
}
|
||||
ls.speedActual.SetText(s)
|
||||
}
|
||||
|
|
10
unix.go
10
unix.go
|
@ -2,13 +2,13 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"strings"
|
||||
"regexp"
|
||||
"errors"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -91,7 +91,9 @@ func alphaOnly(s string) bool {
|
|||
func normalizeVersion(s string) string {
|
||||
// reg, err := regexp.Compile("[^a-zA-Z0-9]+")
|
||||
parts := strings.Split(s, "-")
|
||||
if len(parts) == 0 { return "" }
|
||||
if len(parts) == 0 {
|
||||
return ""
|
||||
}
|
||||
reg, err := regexp.Compile("[^0-9.]+")
|
||||
if err != nil {
|
||||
log.Log(WARN, "normalizeVersion() regexp.Compile() ERROR =", err)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
"errors"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -67,9 +67,9 @@ func (rs *RepoStatus) setSpeed(duration time.Duration) {
|
|||
}
|
||||
rs.speedActual.SetText(s)
|
||||
|
||||
if (duration > 500 * time.Millisecond ) {
|
||||
if duration > 500*time.Millisecond {
|
||||
rs.speed.SetText("SLOW")
|
||||
} else if (duration > 100 * time.Millisecond ) {
|
||||
} else if duration > 100*time.Millisecond {
|
||||
rs.speed.SetText("OK")
|
||||
} else {
|
||||
rs.speed.SetText("FAST")
|
||||
|
|
Loading…
Reference in New Issue