-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (46 loc) · 1006 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"flag"
"fmt"
ft "github.com/weaming/itree/filetree"
)
var (
tree = true
human = true
sha256 = false
imo = false
level = 1024
paths = []string{}
)
func init() {
flag.BoolVar(&tree, "t", tree, "tree mode")
flag.BoolVar(&human, "h", human, "human readable size")
flag.BoolVar(&sha256, "sha256", sha256, "with sha256 https://github.com/minio/sha256-simd")
flag.BoolVar(&imo, "imo", imo, "with ImoHash https://github.com/kalafut/imohash")
flag.IntVar(&level, "L", level, "level in tree mode")
flag.Parse()
for i := 0; i < 1000; i++ {
p := flag.Arg(i)
if p != "" {
paths = append(paths, p)
} else {
if i == 0 {
paths = append(paths, ".")
} else {
break
}
}
}
}
func main() {
for _, x := range paths {
root := ft.NewFileNode(x, x, nil, true)
fmt.Println(root.AbsPath)
if tree {
ft.PrintFileNodeTree(root, []string{}, 1, level, human, sha256, imo)
} else {
ft.PrintFileNodeSimple(root, human)
}
fmt.Println()
}
}