wip
This commit is contained in:
27
cmd/main.go
27
cmd/main.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user