MCPcopy Create free account
hub / github.com/AndroidPoet/playconsole-cli / runList

Function runList

cmd/playconsole-cli/commands/tracks/tracks.go:126–174  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

124}
125
126func runList(cmd *cobra.Command, args []string) error {
127 if err := cli.RequirePackage(cmd); err != nil {
128 return err
129 }
130
131 client, err := api.NewClient(cli.GetPackageName(), 60*time.Second)
132 if err != nil {
133 return err
134 }
135
136 edit, err := client.CreateEdit()
137 if err != nil {
138 return err
139 }
140 defer edit.Close()
141 defer func() {
142 _ = edit.Delete()
143 }()
144
145 tracks, err := edit.Tracks().List(client.GetPackageName(), edit.ID()).Context(edit.Context()).Do()
146 if err != nil {
147 return err
148 }
149
150 result := make([]TrackInfo, 0, len(tracks.Tracks))
151 for _, t := range tracks.Tracks {
152 info := TrackInfo{
153 Track: t.Track,
154 ReleaseCount: len(t.Releases),
155 }
156
157 // Get latest release info
158 if len(t.Releases) > 0 {
159 latest := t.Releases[0]
160 info.VersionCodes = latest.VersionCodes
161 info.Status = latest.Status
162
163 if latest.UserFraction > 0 {
164 info.Rollout = latest.UserFraction * 100
165 } else if latest.Status == "completed" {
166 info.Rollout = 100
167 }
168 }
169
170 result = append(result, info)
171 }
172
173 return output.Print(result)
174}
175
176func runGet(cmd *cobra.Command, args []string) error {
177 if err := cli.RequirePackage(cmd); err != nil {

Callers

nothing calls this directly

Calls 11

CreateEditMethod · 0.95
GetPackageNameMethod · 0.95
RequirePackageFunction · 0.92
NewClientFunction · 0.92
GetPackageNameFunction · 0.92
PrintFunction · 0.92
CloseMethod · 0.80
DeleteMethod · 0.80
TracksMethod · 0.80
IDMethod · 0.80
ContextMethod · 0.45

Tested by

no test coverage detected