sort objects list (#438)

This commit is contained in:
Michael Quigley 2024-01-10 15:14:04 -05:00
parent 3ccbfe2829
commit 6a1f429749
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"net/url" "net/url"
"os" "os"
"sort"
) )
func init() { func init() {
@ -55,6 +56,9 @@ func (cmd *dirCommand) run(_ *cobra.Command, args []string) {
if err != nil { if err != nil {
tui.Error("error listing directory", err) tui.Error("error listing directory", err)
} }
sort.Slice(objects, func(i, j int) bool {
return objects[i].Path < objects[j].Path
})
tw := table.NewWriter() tw := table.NewWriter()
tw.SetOutputMirror(os.Stdout) tw.SetOutputMirror(os.Stdout)