Sort by file extensions (#230)

- preserve natural ordering of filenames if extensions are the same
  or are missing
- files without extensions rank higher on ascending sort and lower
  on descending sort
This commit is contained in:
Kennedy Mwenja authored and gokcehan committed 2019-10-04 21:44:52 +03:00
1 parent 41339a9e5a
commit 9991a40e87
4 files changed
+32 -1

No files matched your search

+2
View File
@@ -11,6 +11,7 @@ const (
timeSort
atimeSort
ctimeSort
extSort
)
type sortOption byte
@@ -157,6 +158,7 @@ func init() {
gOpts.keys["st"] = &listExpr{[]expr{&setExpr{"sortby", "time"}, &setExpr{"info", "time"}}}
gOpts.keys["sa"] = &listExpr{[]expr{&setExpr{"sortby", "atime"}, &setExpr{"info", "atime"}}}
gOpts.keys["sc"] = &listExpr{[]expr{&setExpr{"sortby", "ctime"}, &setExpr{"info", "ctime"}}}
gOpts.keys["se"] = &listExpr{[]expr{&setExpr{"sortby", "ext"}, &setExpr{"info", ""}}}
gOpts.keys["gh"] = &callExpr{"cd", []string{"~"}, 1}
gOpts.cmdkeys = make(map[string]expr)