From 038a89577254b420159ecb11aad98ccbf2924221 Mon Sep 17 00:00:00 2001 From: Daniel Heath Date: Thu, 18 Jan 2018 17:12:03 +1100 Subject: [PATCH] Sort 'ls' page by recent --- page.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/page.go b/page.go index f142afc..849d97b 100755 --- a/page.go +++ b/page.go @@ -6,6 +6,7 @@ import ( "os" "path" "regexp" + "sort" "strings" "time" @@ -65,6 +66,7 @@ func DirectoryList() []DirectoryEntry { 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 }