Browse Source

wip: naive datasheet file gathering

main
decentral1se 2 years ago
parent
commit
8033dfea85
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 17
      gshmm.go

17
gshmm.go

@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/charmbracelet/bubbles/textinput"
@ -44,8 +45,20 @@ func initialModel() model {
input := textinput.New()
input.Focus()
// TODO(d1): gather actual datasheets
ds := []string{"foo", "bar", "baz", "bing"}
var ds []string
// 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{
filterInput: input,

Loading…
Cancel
Save