root.yaml prio, otherwise sort -f results

Bel LaPointe 2022-01-08 23:44:30 -05:00
parent c559c8eba6
commit 05f5244cd1
2 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"path"
"sort"
"strings"
"syscall"
@ -387,5 +388,11 @@ func listDir(dname string) ([]string, error) {
}
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
}

4
cmd/pttodo-cli/testdata/root.yaml vendored Normal file
View File

@ -0,0 +1,4 @@
todo:
- root
scheduled: []
done: []