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:
parent
a36f8e318e
commit
038a895772
2
page.go
2
page.go
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user