(ctx context.Context, flags *RootFlags)
| 34 | } |
| 35 | |
| 36 | func (c *DocsCommentsListCmd) Run(ctx context.Context, flags *RootFlags) error { |
| 37 | u := ui.FromContext(ctx) |
| 38 | docID := normalizeGoogleID(strings.TrimSpace(c.DocID)) |
| 39 | if docID == "" { |
| 40 | return usage("empty docId") |
| 41 | } |
| 42 | if c.Max <= 0 { |
| 43 | return usage("max must be > 0") |
| 44 | } |
| 45 | since, err := normalizeDriveCommentSince(c.Since) |
| 46 | if err != nil { |
| 47 | return err |
| 48 | } |
| 49 | |
| 50 | _, svc, err := requireDriveService(ctx, flags) |
| 51 | if err != nil { |
| 52 | return err |
| 53 | } |
| 54 | comments, nextPageToken, err := listDriveComments(ctx, svc, docID, driveCommentListOptions{ |
| 55 | resourceKey: "docId", |
| 56 | resourceID: docID, |
| 57 | includeResolved: c.IncludeResolved, |
| 58 | scanForOpen: true, |
| 59 | page: c.Page, |
| 60 | since: since, |
| 61 | all: c.All, |
| 62 | failEmpty: c.FailEmpty, |
| 63 | max: c.Max, |
| 64 | emptyMessage: "No comments", |
| 65 | mode: driveCommentListModeExpanded, |
| 66 | }) |
| 67 | if err != nil { |
| 68 | return err |
| 69 | } |
| 70 | return writeDriveCommentList(ctx, u, driveCommentListOptions{ |
| 71 | resourceKey: "docId", |
| 72 | resourceID: docID, |
| 73 | failEmpty: c.FailEmpty, |
| 74 | emptyMessage: "No comments", |
| 75 | mode: driveCommentListModeExpanded, |
| 76 | }, comments, nextPageToken) |
| 77 | } |
| 78 | |
| 79 | // DocsCommentsGetCmd retrieves a single comment by ID. |
| 80 | type DocsCommentsGetCmd struct { |
nothing calls this directly
no test coverage detected