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

Method Run

internal/cmd/keep.go:199–238  ·  view source on GitHub ↗
(ctx context.Context, flags *RootFlags, keep *KeepCmd)

Source from the content-addressed store, hash-verified

197}
198
199func (c *KeepGetCmd) Run(ctx context.Context, flags *RootFlags, keep *KeepCmd) error {
200 u := ui.FromContext(ctx)
201
202 svc, err := getKeepService(ctx, flags, keep)
203 if err != nil {
204 return err
205 }
206
207 name := c.NoteID
208 if !strings.HasPrefix(name, "notes/") {
209 name = "notes/" + name
210 }
211
212 note, err := svc.Notes.Get(name).Do()
213 if err != nil {
214 return err
215 }
216
217 if outfmt.IsJSON(ctx) {
218 return outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{"note": note})
219 }
220
221 u.Out().Linef("name\t%s", note.Name)
222 u.Out().Linef("title\t%s", note.Title)
223 u.Out().Linef("created\t%s", note.CreateTime)
224 u.Out().Linef("updated\t%s", note.UpdateTime)
225 u.Out().Linef("trashed\t%v", note.Trashed)
226 if note.Body != nil && note.Body.Text != nil {
227 u.Out().Println("")
228 u.Out().Println(note.Body.Text.Text)
229 }
230 if len(note.Attachments) > 0 {
231 u.Out().Println("")
232 u.Out().Linef("attachments\t%d", len(note.Attachments))
233 for _, a := range note.Attachments {
234 u.Out().Linef(" %s\t%s", a.Name, a.MimeType)
235 }
236 }
237 return nil
238}
239
240type KeepAttachmentCmd struct {
241 AttachmentName string `arg:"" name:"attachmentName" help:"Attachment name (e.g. notes/abc123/attachments/xyz789)"`

Callers

nothing calls this directly

Calls 10

FromContextFunction · 0.92
IsJSONFunction · 0.92
WriteJSONFunction · 0.92
getKeepServiceFunction · 0.85
stdoutWriterFunction · 0.85
LinefMethod · 0.80
OutMethod · 0.80
PrintlnMethod · 0.80
DoMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected