mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Todo and TextFile have keyboard short-cut to open file in OS
This commit is contained in:
@@ -3,6 +3,7 @@ package todo
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
//"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
@@ -82,6 +83,11 @@ func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
case "n":
|
||||
// Add a new item
|
||||
return nil
|
||||
case "o":
|
||||
// Open the file
|
||||
//widget.openFile()
|
||||
wtf.OpenFile(widget.FilePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
switch event.Key() {
|
||||
@@ -133,6 +139,14 @@ func (widget *Widget) load() {
|
||||
yaml.Unmarshal(fileData, &widget.list)
|
||||
}
|
||||
|
||||
//func (widget *Widget) openFile() {
|
||||
//confDir, _ := wtf.ConfigDir()
|
||||
//filePath := fmt.Sprintf("%s/%s", confDir, widget.FilePath)
|
||||
|
||||
//cmd := exec.Command("open", filePath)
|
||||
//wtf.ExecuteCommand(cmd)
|
||||
//}
|
||||
|
||||
// persist writes the todo list to Yaml file
|
||||
func (widget *Widget) persist() {
|
||||
confDir, _ := wtf.ConfigDir()
|
||||
|
||||
Reference in New Issue
Block a user