| 106 | } |
| 107 | |
| 108 | func printSyncResult(_ string, result *sync.SyncResult, quietMode bool) { |
| 109 | if quietMode { |
| 110 | return |
| 111 | } |
| 112 | |
| 113 | if len(result.Created) > 0 { |
| 114 | fmt.Printf(" Created %d task(s):\n", len(result.Created)) |
| 115 | for _, a := range result.Created { |
| 116 | fmt.Printf(" + [%s] %s\n", a.LocalID, a.Title) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | if len(result.Updated) > 0 { |
| 121 | fmt.Printf(" Updated %d task(s):\n", len(result.Updated)) |
| 122 | for _, a := range result.Updated { |
| 123 | fmt.Printf(" ~ [%s] %s\n", a.LocalID, a.Title) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if len(result.Conflicts) > 0 { |
| 128 | fmt.Printf(" Conflicts %d task(s) (skipped, local changes detected):\n", len(result.Conflicts)) |
| 129 | for _, a := range result.Conflicts { |
| 130 | fmt.Printf(" ! [%s] %s\n", a.LocalID, a.Title) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if len(result.Skipped) > 0 { |
| 135 | fmt.Printf(" Skipped %d task(s) (no changes)\n", len(result.Skipped)) |
| 136 | } |
| 137 | |
| 138 | if len(result.Errors) > 0 { |
| 139 | fmt.Printf(" Errors %d task(s):\n", len(result.Errors)) |
| 140 | for _, e := range result.Errors { |
| 141 | fmt.Printf(" x [%s] %s: %v\n", e.ExternalID, e.Title, e.Err) |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | total := len(result.Created) + len(result.Updated) + len(result.Skipped) + len(result.Conflicts) |
| 146 | fmt.Printf(" Done: %d total, %d created, %d updated, %d skipped, %d conflicts\n", |
| 147 | total, len(result.Created), len(result.Updated), len(result.Skipped), len(result.Conflicts)) |
| 148 | } |