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

Method Run

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

Source from the content-addressed store, hash-verified

71}
72
73func (c *AppScriptContentCmd) Run(ctx context.Context, flags *RootFlags) error {
74 account, err := requireAccount(flags)
75 if err != nil {
76 return err
77 }
78 scriptID := strings.TrimSpace(normalizeGoogleID(c.ScriptID))
79 if scriptID == "" {
80 return usage("empty scriptId")
81 }
82
83 svc, err := appScriptService(ctx, account)
84 if err != nil {
85 return err
86 }
87 content, err := svc.Projects.GetContent(scriptID).Context(ctx).Do()
88 if err != nil {
89 return err
90 }
91
92 if outfmt.IsJSON(ctx) {
93 return outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{
94 "content": content,
95 })
96 }
97
98 u := ui.FromContext(ctx)
99 u.Out().Linef("script_id\t%s", content.ScriptId)
100 u.Out().Linef("files\t%d", len(content.Files))
101 for _, file := range content.Files {
102 if file == nil {
103 continue
104 }
105 u.Out().Linef("file\t%s\t%s", file.Name, file.Type)
106 }
107 return nil
108}
109
110type AppScriptRunCmd struct {
111 ScriptID string `arg:"" name:"scriptId" help:"Script ID"`

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected