NewCmd returns a new sync command
(ctx context.DnoteCtx)
| 45 | |
| 46 | // NewCmd returns a new sync command |
| 47 | func NewCmd(ctx context.DnoteCtx) *cobra.Command { |
| 48 | cmd := &cobra.Command{ |
| 49 | Use: "sync", |
| 50 | Aliases: []string{"s"}, |
| 51 | Short: "Sync data with the server", |
| 52 | Example: example, |
| 53 | RunE: newRun(ctx), |
| 54 | } |
| 55 | |
| 56 | f := cmd.Flags() |
| 57 | f.BoolVarP(&isFullSync, "full", "f", false, "perform a full sync instead of incrementally syncing only the changed data.") |
| 58 | f.StringVar(&apiEndpointFlag, "apiEndpoint", "", "API endpoint to connect to (defaults to value in config)") |
| 59 | |
| 60 | return cmd |
| 61 | } |
| 62 | |
| 63 | func getLastSyncAt(tx *database.DB) (int, error) { |
| 64 | var ret int |