package command import ( "github.com/urfave/cli/v2" "go-mod.ewintr.nl/planner/plan/storage" "go-mod.ewintr.nl/planner/sync/client" ) 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(client *client.Client, localRepo storage.LocalID, eventRepo storage.Event) *cli.Command { SyncCmd.Action = func(cCtx *cli.Context) error { return Sync(client, localRepo, eventRepo, cCtx.Bool("full")) } return SyncCmd } func Sync(client *client.Client, localRepo storage.LocalID, eventRepo storage.Event, full bool) error { // get new/updated items // delete deleted // update existing // localid and add new // find local new and updated // send new and updated return nil }