File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 8
8
dirSortLast dirSort = 1
9
9
)
10
10
11
+ const (
12
+ nameAsc byte = 'n'
13
+ nameDesc byte = 'N'
14
+ sizeAsc byte = 's'
15
+ sizeDesc byte = 'S'
16
+ timeAsc byte = 't'
17
+ timeDesc byte = 'T'
18
+ )
19
+
11
20
type SortState struct {
12
21
dirSort dirSort
13
22
key byte
@@ -51,32 +60,32 @@ func (info SortState) NextDirSort() string {
51
60
func (info SortState ) NextNameSort () string {
52
61
var nextKey byte
53
62
switch info .key {
54
- case 'n' :
55
- nextKey = 'N'
63
+ case nameAsc :
64
+ nextKey = nameDesc
56
65
default :
57
- nextKey = 'n'
66
+ nextKey = nameAsc
58
67
}
59
68
return info .mergeDirWithKey (nextKey )
60
69
}
61
70
62
71
func (info SortState ) NextSizeSort () string {
63
72
var nextKey byte
64
73
switch info .key {
65
- case 's' :
66
- nextKey = 'S'
74
+ case sizeAsc :
75
+ nextKey = sizeDesc
67
76
default :
68
- nextKey = 's'
77
+ nextKey = sizeAsc
69
78
}
70
79
return info .mergeDirWithKey (nextKey )
71
80
}
72
81
73
82
func (info SortState ) NextTimeSort () string {
74
83
var nextKey byte
75
84
switch info .key {
76
- case 't' :
77
- nextKey = 'T'
85
+ case timeAsc :
86
+ nextKey = timeDesc
78
87
default :
79
- nextKey = 't'
88
+ nextKey = timeAsc
80
89
}
81
90
return info .mergeDirWithKey (nextKey )
82
91
}
You can’t perform that action at this time.
0 commit comments