mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Properly scope Config to the wtf package and remove it as a dependency from everywhere else
This commit is contained in:
@@ -50,12 +50,12 @@ func (repo *GitRepo) changedFiles() []string {
|
||||
}
|
||||
|
||||
func (repo *GitRepo) commits() []string {
|
||||
numStr := fmt.Sprintf("-n %d", Config.UInt("wtf.mods.git.commitCount", 10))
|
||||
numStr := fmt.Sprintf("-n %d", wtf.Config.UInt("wtf.mods.git.commitCount", 10))
|
||||
|
||||
dateFormat := Config.UString("wtf.mods.git.dateFormat", "%b %d, %Y")
|
||||
dateFormat := wtf.Config.UString("wtf.mods.git.dateFormat", "%b %d, %Y")
|
||||
dateStr := fmt.Sprintf("--date=format:\"%s\"", dateFormat)
|
||||
|
||||
commitFormat := Config.UString("wtf.mods.git.commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]")
|
||||
commitFormat := wtf.Config.UString("wtf.mods.git.commitFormat", "[forestgreen]%h [white]%s [grey]%an on %cd[white]")
|
||||
commitStr := fmt.Sprintf("--pretty=format:\"%s\"", commitFormat)
|
||||
|
||||
arg := []string{repo.gitDir(), repo.workTree(), "log", dateStr, numStr, commitStr}
|
||||
|
||||
@@ -2,14 +2,10 @@ package git
|
||||
|
||||
import (
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
// Config is a pointer to the global config object
|
||||
var Config *config.Config
|
||||
|
||||
const HelpText = `
|
||||
Keyboard commands for Git:
|
||||
|
||||
@@ -53,7 +49,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
repoPaths := wtf.ToStrs(Config.UList("wtf.mods.git.repositories"))
|
||||
repoPaths := wtf.ToStrs(wtf.Config.UList("wtf.mods.git.repositories"))
|
||||
|
||||
widget.UpdateRefreshedAt()
|
||||
widget.Data = widget.gitRepos(repoPaths)
|
||||
|
||||
Reference in New Issue
Block a user