(ctx context.Context, comments []*drive.Comment, includeQuoted bool)
| 269 | } |
| 270 | |
| 271 | func printCompactCommentTable(ctx context.Context, comments []*drive.Comment, includeQuoted bool) { |
| 272 | w, flush := tableWriter(ctx) |
| 273 | defer flush() |
| 274 | if includeQuoted { |
| 275 | fmt.Fprintln(w, "ID\tAUTHOR\tQUOTED\tCONTENT\tCREATED\tRESOLVED\tREPLIES") |
| 276 | } else { |
| 277 | fmt.Fprintln(w, "ID\tAUTHOR\tCONTENT\tCREATED\tRESOLVED\tREPLIES") |
| 278 | } |
| 279 | for _, comment := range comments { |
| 280 | if comment == nil { |
| 281 | continue |
| 282 | } |
| 283 | author := "" |
| 284 | if comment.Author != nil { |
| 285 | author = comment.Author.DisplayName |
| 286 | } |
| 287 | content := truncateString(comment.Content, 50) |
| 288 | replyCount := len(comment.Replies) |
| 289 | if includeQuoted { |
| 290 | quoted := "" |
| 291 | if comment.QuotedFileContent != nil { |
| 292 | quoted = truncateString(comment.QuotedFileContent.Value, 30) |
| 293 | } |
| 294 | fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%t\t%d\n", |
| 295 | comment.Id, |
| 296 | author, |
| 297 | quoted, |
| 298 | content, |
| 299 | formatDateTime(comment.CreatedTime), |
| 300 | comment.Resolved, |
| 301 | replyCount, |
| 302 | ) |
| 303 | continue |
| 304 | } |
| 305 | fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%t\t%d\n", |
| 306 | comment.Id, |
| 307 | author, |
| 308 | content, |
| 309 | formatDateTime(comment.CreatedTime), |
| 310 | comment.Resolved, |
| 311 | replyCount, |
| 312 | ) |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | func getDriveComment(ctx context.Context, svc *drive.Service, fileID, commentID string) (*drive.Comment, error) { |
| 317 | return svc.Comments.Get(fileID, commentID). |
no test coverage detected