(cmd *cobra.Command, args []string)
| 124 | } |
| 125 | |
| 126 | func 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 | |
| 176 | func runGet(cmd *cobra.Command, args []string) error { |
| 177 | if err := cli.RequirePackage(cmd); err != nil { |
nothing calls this directly
no test coverage detected