-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
66 lines (49 loc) · 995 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"easy-copy/color"
"easy-copy/flags"
"easy-copy/flags/impl"
"easy-copy/iterator"
"easy-copy/progress"
"easy-copy/tasks"
"easy-copy/ui"
"easy-copy/ui/handler"
"os"
"strings"
"time"
)
func main() {
go handler.Handle()
flags.Current = impl.New()
color.Init(color.AutoColors())
flags.Current.LoadConfig(os.Args)
args, err := flags.Sep(strings.Join(os.Args, " "))
if err != nil {
ui.Error(err)
}
flags.Current.ParseLine(args)
if flags.Current.Verbosity() >= flags.VerbInfo {
ui.PrintVersion()
flags.VerbFlags()
}
if flags.Current.Parallel() {
runParallel()
return
}
// go setOptimalBuffersize()
progress.Start = time.Now()
go iterator.Iterate()
go drawLoop()
go progress.WatchSpeed()
go progress.Watchdog()
tasks.CopyLoop()
printSummary()
}
func runParallel() {
iterator.Iterate()
println("confirm?")
buf := make([]byte, 8)
os.Stdin.Read(buf) // wait for confirmation on task list
tasks.CopyLoop()
printSummary()
}