diff --git a/plan/command/sync.go b/plan/command/sync.go new file mode 100644 index 0000000..5a1b80b --- /dev/null +++ b/plan/command/sync.go @@ -0,0 +1,30 @@ +package command + +import ( + "github.com/urfave/cli/v2" + "go-mod.ewintr.nl/planner/plan/storage" +) + +var SyncCmd = &cli.Command{ + Name: "sync", + Usage: "Synchonize with server", + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "full", + Aliases: []string{"f"}, + Usage: "Force full sync", + }, + }, +} + +func NewSyncCmd(localRepo storage.LocalID, eventRepo storage.Event) *cli.Command { + SyncCmd.Action = func(cCtx *cli.Context) error { + return Sync(localRepo, eventRepo, cCtx.Bool("full")) + } + return SyncCmd +} + +func Sync(localRepo storage.LocalID, eventRepo storage.Event, full bool) error { + + return nil +} diff --git a/plan/main.go b/plan/main.go index bb6b8e7..ac217af 100644 --- a/plan/main.go +++ b/plan/main.go @@ -44,42 +44,6 @@ func main() { fmt.Println(err) os.Exit(1) } - - // all, err := repo.FindAll() - // if err != nil { - // fmt.Println(err) - // os.Exit(1) - // } - - // fmt.Printf("all: %+v\n", all) - - // c := client.NewClient("http://localhost:8092", "testKey") - // items, err := c.Updated([]item.Kind{item.KindEvent}, time.Time{}) - // if err != nil { - // fmt.Println(err) - // os.Exit(1) - // } - - // fmt.Printf("%+v\n", items) - - // i := item.Item{ - // ID: "id-1", - // Kind: item.KindEvent, - // Updated: time.Now(), - // Body: "body", - // } - // if err := c.Update([]item.Item{i}); err != nil { - // fmt.Println(err) - // os.Exit(1) - // } - - // items, err = c.Updated([]item.Kind{item.KindEvent}, time.Time{}) - // if err != nil { - // fmt.Println(err) - // os.Exit(1) - // } - - // fmt.Printf("%+v\n", items) } type Configuration struct {