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

Method Run

internal/cmd/appscript.go:25–67  ·  view source on GitHub ↗
(ctx context.Context, flags *RootFlags)

Source from the content-addressed store, hash-verified

23}
24
25func (c *AppScriptGetCmd) Run(ctx context.Context, flags *RootFlags) error {
26 account, err := requireAccount(flags)
27 if err != nil {
28 return err
29 }
30 scriptID := strings.TrimSpace(normalizeGoogleID(c.ScriptID))
31 if scriptID == "" {
32 return usage("empty scriptId")
33 }
34
35 svc, err := appScriptService(ctx, account)
36 if err != nil {
37 return err
38 }
39 project, err := svc.Projects.Get(scriptID).Context(ctx).Do()
40 if err != nil {
41 return err
42 }
43
44 if outfmt.IsJSON(ctx) {
45 return outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{
46 "project": project,
47 "editor_url": appScriptEditURL(scriptID),
48 })
49 }
50
51 u := ui.FromContext(ctx)
52 u.Out().Linef("script_id\t%s", project.ScriptId)
53 if project.Title != "" {
54 u.Out().Linef("title\t%s", project.Title)
55 }
56 if project.ParentId != "" {
57 u.Out().Linef("parent_id\t%s", project.ParentId)
58 }
59 if project.CreateTime != "" {
60 u.Out().Linef("created\t%s", project.CreateTime)
61 }
62 if project.UpdateTime != "" {
63 u.Out().Linef("updated\t%s", project.UpdateTime)
64 }
65 u.Out().Linef("editor_url\t%s", appScriptEditURL(scriptID))
66 return nil
67}
68
69type AppScriptContentCmd struct {
70 ScriptID string `arg:"" name:"scriptId" help:"Script ID"`

Callers

nothing calls this directly

Calls 13

IsJSONFunction · 0.92
WriteJSONFunction · 0.92
FromContextFunction · 0.92
requireAccountFunction · 0.85
normalizeGoogleIDFunction · 0.85
usageFunction · 0.85
appScriptServiceFunction · 0.85
stdoutWriterFunction · 0.85
appScriptEditURLFunction · 0.85
LinefMethod · 0.80
OutMethod · 0.80
DoMethod · 0.65

Tested by

no test coverage detected