MCPcopy Create free account
hub / github.com/openclaw/gogcli / writeDriveCommentList

Function writeDriveCommentList

internal/cmd/comment_ops.go:200–221  ·  view source on GitHub ↗
(ctx context.Context, u *ui.UI, opts driveCommentListOptions, comments []*drive.Comment, nextPageToken string)

Source from the content-addressed store, hash-verified

198}
199
200func 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
223func printExpandedCommentTable(ctx context.Context, comments []*drive.Comment) {
224 w, flush := tableWriter(ctx)

Callers 2

RunMethod · 0.85
RunMethod · 0.85

Calls 8

IsJSONFunction · 0.92
writePagedJSONResultFunction · 0.85
failEmptyExitFunction · 0.85
printCompactCommentTableFunction · 0.85
printNextPageHintWithAllFunction · 0.85
PrintlnMethod · 0.80
ErrMethod · 0.80

Tested by

no test coverage detected