1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Sort 'ls' page by recent

This commit is contained in:
Daniel Heath 2018-01-18 17:12:03 +11:00
parent a36f8e318e
commit 038a895772

View File

@ -6,6 +6,7 @@ import (
"os" "os"
"path" "path"
"regexp" "regexp"
"sort"
"strings" "strings"
"time" "time"
@ -65,6 +66,7 @@ func DirectoryList() []DirectoryEntry {
LastEdited: time.Unix(p.Text.LastEditTime()/1000000000, 0), LastEdited: time.Unix(p.Text.LastEditTime()/1000000000, 0),
} }
} }
sort.Slice(entries, func(i, j int) bool { return entries[i].LastEdited.After(entries[j].LastEdited) })
return entries return entries
} }