| 146 | } |
| 147 | |
| 148 | func buildSetOutput(input SetInput, req taskfile.UpdateRequest, filePath string) setOutput { |
| 149 | updated := make(map[string]string) |
| 150 | if input.Status != "" { |
| 151 | updated["status"] = input.Status |
| 152 | } |
| 153 | if input.Priority != "" { |
| 154 | updated["priority"] = input.Priority |
| 155 | } |
| 156 | if input.Effort != "" { |
| 157 | updated["effort"] = input.Effort |
| 158 | } |
| 159 | if input.Owner != "" { |
| 160 | updated["owner"] = input.Owner |
| 161 | } |
| 162 | if input.Tags != nil { |
| 163 | updated["tags"] = strings.Join(input.Tags, ", ") |
| 164 | } |
| 165 | if len(input.AddTags) > 0 { |
| 166 | updated["add_tags"] = strings.Join(input.AddTags, ", ") |
| 167 | } |
| 168 | if len(input.RemTags) > 0 { |
| 169 | updated["rem_tags"] = strings.Join(input.RemTags, ", ") |
| 170 | } |
| 171 | if len(input.AddPRs) > 0 { |
| 172 | updated["add_prs"] = strings.Join(input.AddPRs, ", ") |
| 173 | } |
| 174 | if len(input.RemPRs) > 0 { |
| 175 | updated["rem_prs"] = strings.Join(input.RemPRs, ", ") |
| 176 | } |
| 177 | if req.Completed != nil { |
| 178 | updated["completed_at"] = *req.Completed |
| 179 | } |
| 180 | if req.CancelledAt != nil { |
| 181 | updated["cancelled_at"] = *req.CancelledAt |
| 182 | } |
| 183 | return setOutput{ |
| 184 | TaskID: input.TaskID, |
| 185 | FilePath: filePath, |
| 186 | Updated: updated, |
| 187 | } |
| 188 | } |