@@ -21,18 +21,7 @@ func Long(nodes []node.Node) {
21
21
// populate values
22
22
values := make ([][]string , len (nodes ))
23
23
for i := range values {
24
- node := nodes [i ]
25
- values [i ] = []string {
26
- formatMode (node .Mode ),
27
- strconv .Itoa (node .LinkCount ),
28
- fmt .Sprintf ("%s " , node .User ),
29
- fmt .Sprintf ("%s " , node .Group ),
30
- colorSize (node .Size , humanize .Bytes (node .Size )),
31
- node .Time .Month ().String ()[:3 ],
32
- fmt .Sprintf ("%2d" , node .Time .Day ()),
33
- fmt .Sprintf ("%02d:%02d" , node .Time .Hour (), node .Time .Minute ()),
34
- fmt .Sprintf (" %s" , node .Name ),
35
- }
24
+ values [i ] = extractValues (nodes [i ])
36
25
}
37
26
38
27
// calculate lengths and max lengths
@@ -64,6 +53,20 @@ func Long(nodes []node.Node) {
64
53
}
65
54
}
66
55
56
+ func extractValues (node node.Node ) []string {
57
+ return []string {
58
+ formatMode (node .Mode ),
59
+ strconv .Itoa (node .LinkCount ),
60
+ fmt .Sprintf ("%s " , node .User ),
61
+ fmt .Sprintf ("%s " , node .Group ),
62
+ colorSize (node .Size , humanize .Bytes (node .Size )),
63
+ node .Time .Month ().String ()[:3 ],
64
+ fmt .Sprintf ("%2d" , node .Time .Day ()),
65
+ fmt .Sprintf ("%02d:%02d" , node .Time .Hour (), node .Time .Minute ()),
66
+ fmt .Sprintf (" %s" , node .Name ),
67
+ }
68
+ }
69
+
67
70
func colorSize (sizeInt int , str string ) string {
68
71
size := float64 (sizeInt )
69
72
base := float64 (1024 )
0 commit comments