(_ *commander.Command, _ []string)
| 66 | } |
| 67 | |
| 68 | func aptlyMirrorListJSON(_ *commander.Command, _ []string) error { |
| 69 | var err error |
| 70 | |
| 71 | repos := make([]*deb.RemoteRepo, context.NewCollectionFactory().RemoteRepoCollection().Len()) |
| 72 | i := 0 |
| 73 | _ = context.NewCollectionFactory().RemoteRepoCollection().ForEach(func(repo *deb.RemoteRepo) error { |
| 74 | repos[i] = repo |
| 75 | i++ |
| 76 | return nil |
| 77 | }) |
| 78 | |
| 79 | _ = context.CloseDatabase() |
| 80 | |
| 81 | sort.Slice(repos, func(i, j int) bool { |
| 82 | return repos[i].Name < repos[j].Name |
| 83 | }) |
| 84 | |
| 85 | if output, e := json.MarshalIndent(repos, "", " "); e == nil { |
| 86 | fmt.Println(string(output)) |
| 87 | } else { |
| 88 | err = e |
| 89 | } |
| 90 | |
| 91 | return err |
| 92 | } |
| 93 | |
| 94 | func makeCmdMirrorList() *commander.Command { |
| 95 | cmd := &commander.Command{ |
no test coverage detected