forked from varia/go-sh-manymanuals
wip: naive datasheet file gathering
This commit is contained in:
parent
34424bd317
commit
8033dfea85
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…
Reference in New Issue
Block a user