This commit is contained in:
Bel LaPointe
2023-11-06 13:23:28 -07:00
parent b2a51e65b0
commit 97f2cb197f
3 changed files with 54 additions and 52 deletions

View File

@@ -5,9 +5,6 @@ import (
"io"
"io/ioutil"
"os"
"path"
"sort"
"strings"
"gogs.inhome.blapointe.com/bel/pttodo/pttodo"
@@ -103,27 +100,3 @@ func filePathReader(path string) (io.Reader, error) {
}
return bytes.NewReader(b), nil
}
func listDir(dname string) ([]string, error) {
entries, err := os.ReadDir(dname)
if err != nil {
return nil, err
}
paths := make([]string, 0, len(entries))
for i := range entries {
if entries[i].IsDir() {
continue
}
if strings.HasPrefix(path.Base(entries[i].Name()), ".") {
continue
}
paths = append(paths, path.Join(dname, entries[i].Name()))
}
sort.Slice(paths, func(i, j int) bool {
if path.Base(paths[i]) == "root.yaml" {
return true
}
return paths[i] < paths[j]
})
return paths, nil
}