(ctx context.Context, u *ui.UI, opts driveCommentListOptions, comments []*drive.Comment, nextPageToken string)
| 198 | } |
| 199 | |
| 200 | func writeDriveCommentList(ctx context.Context, u *ui.UI, opts driveCommentListOptions, comments []*drive.Comment, nextPageToken string) error { |
| 201 | if outfmt.IsJSON(ctx) { |
| 202 | return writePagedJSONResult(ctx, map[string]any{ |
| 203 | opts.resourceKey: opts.resourceID, |
| 204 | "comments": comments, |
| 205 | "nextPageToken": nextPageToken, |
| 206 | }, len(comments), opts.failEmpty) |
| 207 | } |
| 208 | |
| 209 | if len(comments) == 0 { |
| 210 | u.Err().Println(opts.emptyMessage) |
| 211 | return failEmptyExit(opts.failEmpty) |
| 212 | } |
| 213 | |
| 214 | if opts.mode == driveCommentListModeExpanded { |
| 215 | printExpandedCommentTable(ctx, comments) |
| 216 | } else { |
| 217 | printCompactCommentTable(ctx, comments, opts.includeQuoted) |
| 218 | } |
| 219 | printNextPageHintWithAll(u, nextPageToken, "--all/--all-pages") |
| 220 | return nil |
| 221 | } |
| 222 | |
| 223 | func printExpandedCommentTable(ctx context.Context, comments []*drive.Comment) { |
| 224 | w, flush := tableWriter(ctx) |
no test coverage detected