File tree 2 files changed +17
-4
lines changed
2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ func main() {
25
25
os .Exit (1 )
26
26
}
27
27
28
- nodes := node .Fetch ()
28
+ nodes := node .Fetch (
29
+ map [string ]bool {
30
+ "all" : * all ,
31
+ },
32
+ )
29
33
30
34
count := 0
31
35
maxSize := maxSize (nodes )
Original file line number Diff line number Diff line change @@ -32,14 +32,23 @@ type Node struct {
32
32
}
33
33
34
34
// Fetch - Fetch nodes in currently directory
35
- func Fetch () []Node {
35
+ func Fetch (options map [ string ] bool ) []Node {
36
36
files , err := ioutil .ReadDir ("." )
37
37
if err != nil { log .Fatal (err ) }
38
38
39
- nodes := make ([]Node , len (files ))
39
+ count := 0
40
+ for i := 0 ; i < len (files ); i ++ {
41
+ if ! options ["all" ] && []rune (files [i ].Name ())[0 ] == '.' { continue }
42
+ count ++
43
+ }
44
+
45
+ nodes := make ([]Node , count )
40
46
47
+ count = 0
41
48
for i := 0 ; i < len (files ); i ++ {
42
- nodes [i ] = new (files [i ])
49
+ if ! options ["all" ] && []rune (files [i ].Name ())[0 ] == '.' { continue }
50
+ nodes [count ] = new (files [i ])
51
+ count ++
43
52
}
44
53
45
54
return nodes
You can’t perform that action at this time.
0 commit comments