(cmd *cobra.Command, args []string)
| 65 | } |
| 66 | |
| 67 | func runDownloads(cmd *cobra.Command, args []string) error { |
| 68 | client := api.NewGitHubClient() |
| 69 | |
| 70 | if byPlatform { |
| 71 | platforms, _, err := client.GetDownloadsByPlatform() |
| 72 | if err != nil { |
| 73 | return fmt.Errorf("failed to fetch platform stats: %w", err) |
| 74 | } |
| 75 | return output.Print(platforms) |
| 76 | } |
| 77 | |
| 78 | if byRelease { |
| 79 | releases, err := client.GetDownloadsByRelease() |
| 80 | if err != nil { |
| 81 | return fmt.Errorf("failed to fetch release stats: %w", err) |
| 82 | } |
| 83 | return output.Print(releases) |
| 84 | } |
| 85 | |
| 86 | // Default: show summary |
| 87 | total, err := client.GetTotalDownloads() |
| 88 | if err != nil { |
| 89 | return fmt.Errorf("failed to fetch download stats: %w", err) |
| 90 | } |
| 91 | |
| 92 | stats := DownloadStats{ |
| 93 | Total: total, |
| 94 | LastUpdated: time.Now().UTC().Format(time.RFC3339), |
| 95 | } |
| 96 | |
| 97 | return output.Print(stats) |
| 98 | } |
| 99 | |
| 100 | func runSources(cmd *cobra.Command, args []string) error { |
| 101 | sources := []DownloadSource{ |
nothing calls this directly
no test coverage detected