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

Function printCompactCommentTable

internal/cmd/comment_ops.go:271–314  ·  view source on GitHub ↗
(ctx context.Context, comments []*drive.Comment, includeQuoted bool)

Source from the content-addressed store, hash-verified

269}
270
271func 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
316func getDriveComment(ctx context.Context, svc *drive.Service, fileID, commentID string) (*drive.Comment, error) {
317 return svc.Comments.Get(fileID, commentID).

Callers 1

writeDriveCommentListFunction · 0.85

Calls 3

tableWriterFunction · 0.85
truncateStringFunction · 0.85
formatDateTimeFunction · 0.85

Tested by

no test coverage detected