@@ -3,38 +3,38 @@ package main
33import (
44 "flag"
55 "fmt"
6- "github.com/TBXark/confstore"
6+ "log"
7+
78 "github.com/TBXark/github-backup/config"
89 "github.com/robfig/cron/v3"
9- "log"
1010)
1111
1212var (
1313 BuildVersion = "dev"
1414)
1515
1616func main () {
17- c := flag .String ("config" , "config.json" , "config file" )
18- v := flag .Bool ("version" , false , "show version" )
19- h := flag .Bool ("help" , false , "show help" )
17+ conf := flag .String ("config" , "config.json" , "config file" )
18+ version := flag .Bool ("version" , false , "show version" )
19+ help := flag .Bool ("help" , false , "show help" )
2020 flag .Parse ()
21- if * v {
21+ if * version {
2222 fmt .Println (BuildVersion )
2323 return
2424 }
25- if * h {
25+ if * help {
2626 flag .Usage ()
2727 return
2828 }
29- conf , err := confstore. Load [ config.SyncConfig ]( * c )
29+ data , err := config .NewConfig ( * conf )
3030 if err != nil {
3131 log .Fatalf ("load config error: %s" , err .Error ())
3232 }
3333
34- syncTask := NewTask (conf )
35- if conf .Cron != "" {
34+ syncTask := NewTask (data )
35+ if data .Cron != "" {
3636 task := cron .New ()
37- _ , e := task .AddJob (conf .Cron , syncTask )
37+ _ , e := task .AddJob (data .Cron , syncTask )
3838 if e != nil {
3939 log .Fatalf ("add cron task error: %s" , e .Error ())
4040 }
0 commit comments