-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (44 loc) · 967 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
package main
import (
"flag"
"fmt"
"github.com/pootow/nofcopy/gomblr"
"github.com/pootow/nofcopy/task"
)
var (
mode = flag.String("mode", "du", "du(disk usage) or cs(checksum)")
sync = flag.Bool("sync", false, "sync will walk dir file one by one, best with non-ssd")
)
func main() {
flag.Parse()
fmt.Println("mode: ", *mode)
switch *mode {
case "du":
if len(flag.Args()) > 0 {
t := task.NewStatTask()
t.Stat(flag.Arg(0))
fmt.Printf("total: %d bytes\n", t.Total)
} else {
fmt.Println("please specify a path.")
}
case "cs":
if len(flag.Args()) > 0 {
t := task.NewChecksumTask()
t.Checksum(flag.Arg(0), *sync)
} else {
fmt.Println("please specify a path.")
}
case "gf":
gomblr.GetFavPosts()
case "gg":
if len(flag.Args()) > 0 {
gomblr.GetBlogPosts(flag.Args())
}
case "gd":
if len(flag.Args()) > 0 {
gomblr.DownloadPosts(flag.Arg(0), flag.Arg(1))
}
case "gdash":
gomblr.GetAllDashbordPosts()
}
}