root.yaml prio, otherwise sort -f results
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@@ -387,5 +388,11 @@ func listDir(dname string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
paths = append(paths, path.Join(dname, entries[i].Name()))
|
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
|
return paths, nil
|
||||||
}
|
}
|
||||||
|
|||||||
4
cmd/pttodo-cli/testdata/root.yaml
vendored
Normal file
4
cmd/pttodo-cli/testdata/root.yaml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
todo:
|
||||||
|
- root
|
||||||
|
scheduled: []
|
||||||
|
done: []
|
||||||
Reference in New Issue
Block a user