wip: naive datasheet file gathering

This commit is contained in:
decentral1se 2023-05-10 09:58:59 +02:00
parent 34424bd317
commit 8033dfea85
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410

View File

@ -4,6 +4,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"path/filepath"
"strings" "strings"
"github.com/charmbracelet/bubbles/textinput" "github.com/charmbracelet/bubbles/textinput"
@ -44,8 +45,20 @@ func initialModel() model {
input := textinput.New() input := textinput.New()
input.Focus() input.Focus()
// TODO(d1): gather actual datasheets var ds []string
ds := []string{"foo", "bar", "baz", "bing"} // TODO(d1): handle error in interface?
_ = filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
name := info.Name()
if strings.HasSuffix(name, "pdf") {
ds = append(ds, name)
}
return nil
})
return model{ return model{
filterInput: input, filterInput: input,