This commit is contained in:
ron 2020-03-18 05:16:25 +01:00
parent 5d4716746c
commit 4f9683689b
3 changed files with 11 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import (
)
var path = flag.String("path", ".", "library path")
var editor = flag.String("editor", os.Getenv("EDITOR"), "editor")
func init() {
flag.Parse()
@ -99,7 +100,7 @@ func main() {
bopt := menu.Option{
Name: book.String(),
Action: menu.ActionExec,
Args: []string{os.Getenv("EDITOR"), book.Path},
Args: []string{*editor, book.Path},
}
bookopts = append(bookopts, bopt)
}

View File

@ -49,6 +49,12 @@ func (mv *MenuView) HandleEvent(e tcell.Event) bool {
case tcell.KeyDown, tcell.KeyCtrlN:
mv.keyDown()
return true
case tcell.KeyLeft:
mv.keyBack()
return true
case tcell.KeyRight:
mv.keyEnter()
return true
case tcell.KeyPgDn, tcell.KeyCtrlF:
mv.keyPgDn()
return true

View File

@ -24,6 +24,9 @@ type Repo struct {
func (lr *Repo) GetMeta() map[string]map[string][]Book {
meta := map[string]map[string][]Book{}
for _, book := range lr.Books {
if book.Meta["DELETED"] != "" {
continue
}
for key, value := range book.Meta {
if meta[key] == nil {
meta[key] = map[string][]Book{}