(ctx context.Context, flags *RootFlags)
| 23 | } |
| 24 | |
| 25 | func (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 | |
| 69 | type AppScriptContentCmd struct { |
| 70 | ScriptID string `arg:"" name:"scriptId" help:"Script ID"` |
nothing calls this directly
no test coverage detected