(cmd *cobra.Command, kind entities.Kind, out io.Writer)
| 1231 | } |
| 1232 | |
| 1233 | func fetchAllRepos(cmd *cobra.Command, kind entities.Kind, out io.Writer) error { |
| 1234 | repos, err := repoconfig.LoadEnabled(kind) |
| 1235 | if err != nil { |
| 1236 | return err |
| 1237 | } |
| 1238 | if len(repos) == 0 { |
| 1239 | fmt.Fprintf(out, "No enabled %s repositories configured\n", kind) |
| 1240 | return nil |
| 1241 | } |
| 1242 | |
| 1243 | totalAdded := 0 |
| 1244 | for key, r := range repos { |
| 1245 | rOwner := r.EffectiveOwner() |
| 1246 | name := r.EffectiveName() |
| 1247 | branch := r.EffectiveBranch() |
| 1248 | subPath := r.SubPath(kind) |
| 1249 | |
| 1250 | if rOwner == "" || name == "" { |
| 1251 | fmt.Fprintf(out, " Skipping %s: missing owner or repo name\n", key) |
| 1252 | continue |
| 1253 | } |
| 1254 | |
| 1255 | fmt.Fprintf(out, " Fetching from %s/%s@%s ...\n", rOwner, name, branch) |
| 1256 | added, err := fetchSingleRepoCount(kind, rOwner, name, branch, subPath) |
| 1257 | if err != nil { |
| 1258 | fmt.Fprintf(out, " Error: %v\n", err) |
| 1259 | continue |
| 1260 | } |
| 1261 | fmt.Fprintf(out, " Found %d %s(s)\n", added, kind) |
| 1262 | totalAdded += added |
| 1263 | } |
| 1264 | |
| 1265 | fmt.Fprintf(out, "\nTotal: fetched %d %s(s) from %d repos\n", totalAdded, kind, len(repos)) |
| 1266 | return nil |
| 1267 | } |
| 1268 | |
| 1269 | func fetchSingleRepo(kind entities.Kind, owner, repo, branch, path string, out io.Writer) error { |
| 1270 | added, err := fetchSingleRepoCount(kind, owner, repo, branch, path) |
no test coverage detected