diff --git a/cmd/pttodo-cli/cli.go b/cmd/pttodo-cli/cli.go index 3cda561..d1c5fdd 100644 --- a/cmd/pttodo-cli/cli.go +++ b/cmd/pttodo-cli/cli.go @@ -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 } diff --git a/cmd/pttodo-cli/testdata/root.yaml b/cmd/pttodo-cli/testdata/root.yaml new file mode 100644 index 0000000..fc779e6 --- /dev/null +++ b/cmd/pttodo-cli/testdata/root.yaml @@ -0,0 +1,4 @@ +todo: +- root +scheduled: [] +done: []