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

Add cfg/ as a top-level package concept

This commit is contained in:
Chris Cummer
2018-06-09 03:58:45 -07:00
parent 00c07a9421
commit d2dfcd8978
3 changed files with 13 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/gdamore/tcell"
"github.com/olebedev/config"
"github.com/rivo/tview"
"github.com/senorprogrammer/wtf/cfg"
"github.com/senorprogrammer/wtf/wtf"
"gopkg.in/yaml.v2"
)
@@ -95,7 +96,7 @@ func (widget *Widget) editItem() {
}
func (widget *Widget) init() {
_, err := wtf.CreateFile(widget.filePath)
_, err := cfg.CreateFile(widget.filePath)
if err != nil {
panic(err)
}
@@ -177,7 +178,7 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
// Loads the todo list from Yaml file
func (widget *Widget) load() {
confDir, _ := wtf.ConfigDir()
confDir, _ := cfg.ConfigDir()
filePath := fmt.Sprintf("%s/%s", confDir, widget.filePath)
fileData, _ := wtf.ReadFileBytes(filePath)
@@ -203,7 +204,7 @@ func (widget *Widget) newItem() {
// persist writes the todo list to Yaml file
func (widget *Widget) persist() {
confDir, _ := wtf.ConfigDir()
confDir, _ := cfg.ConfigDir()
filePath := fmt.Sprintf("%s/%s", confDir, widget.filePath)
fileData, _ := yaml.Marshal(&widget.list)