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

Function writeDriveCommentDetail

internal/cmd/comment_ops.go:323–362  ·  view source on GitHub ↗
(ctx context.Context, u *ui.UI, comment *drive.Comment, includeAnchor, includeReplyDetails bool)

Source from the content-addressed store, hash-verified

321}
322
323func writeDriveCommentDetail(ctx context.Context, u *ui.UI, comment *drive.Comment, includeAnchor, includeReplyDetails bool) error {
324 if outfmt.IsJSON(ctx) {
325 return outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{"comment": comment})
326 }
327
328 u.Out().Linef("id\t%s", comment.Id)
329 if comment.Author != nil {
330 u.Out().Linef("author\t%s", comment.Author.DisplayName)
331 }
332 u.Out().Linef("content\t%s", comment.Content)
333 u.Out().Linef("created\t%s", comment.CreatedTime)
334 u.Out().Linef("modified\t%s", comment.ModifiedTime)
335 u.Out().Linef("resolved\t%t", comment.Resolved)
336 if comment.QuotedFileContent != nil && comment.QuotedFileContent.Value != "" {
337 u.Out().Linef("quoted\t%s", comment.QuotedFileContent.Value)
338 }
339 if includeAnchor && strings.TrimSpace(comment.Anchor) != "" {
340 u.Out().Linef("anchor\t%s", comment.Anchor)
341 }
342 if len(comment.Replies) > 0 {
343 u.Out().Linef("replies\t%d", len(comment.Replies))
344 }
345 if includeReplyDetails {
346 for _, reply := range comment.Replies {
347 if reply == nil {
348 continue
349 }
350 author := ""
351 if reply.Author != nil {
352 author = reply.Author.DisplayName
353 }
354 action := ""
355 if strings.TrimSpace(reply.Action) != "" {
356 action = reply.Action
357 }
358 u.Out().Linef(" reply\t%s\t%s\t%s\t%s", reply.Id, author, truncateString(reply.Content, 60), action)
359 }
360 }
361 return nil
362}
363
364func createDriveComment(ctx context.Context, svc *drive.Service, fileID, content, quoted, anchor string) (*drive.Comment, error) {
365 comment := &drive.Comment{Content: content}

Callers 2

RunMethod · 0.85
RunMethod · 0.85

Calls 6

IsJSONFunction · 0.92
WriteJSONFunction · 0.92
stdoutWriterFunction · 0.85
truncateStringFunction · 0.85
LinefMethod · 0.80
OutMethod · 0.80

Tested by

no test coverage detected