(_ *commander.Command, _ []string)
| 72 | } |
| 73 | |
| 74 | func aptlyRepoListJSON(_ *commander.Command, _ []string) error { |
| 75 | var err error |
| 76 | |
| 77 | repos := make([]*deb.LocalRepo, context.NewCollectionFactory().LocalRepoCollection().Len()) |
| 78 | i := 0 |
| 79 | _ = context.NewCollectionFactory().LocalRepoCollection().ForEach(func(repo *deb.LocalRepo) error { |
| 80 | e := context.NewCollectionFactory().LocalRepoCollection().LoadComplete(repo) |
| 81 | if e != nil { |
| 82 | return e |
| 83 | } |
| 84 | |
| 85 | repos[i] = repo |
| 86 | i++ |
| 87 | return nil |
| 88 | }) |
| 89 | |
| 90 | _ = context.CloseDatabase() |
| 91 | |
| 92 | sort.Slice(repos, func(i, j int) bool { |
| 93 | return repos[i].Name < repos[j].Name |
| 94 | }) |
| 95 | if output, e := json.MarshalIndent(repos, "", " "); e == nil { |
| 96 | fmt.Println(string(output)) |
| 97 | } else { |
| 98 | err = e |
| 99 | } |
| 100 | |
| 101 | return err |
| 102 | } |
| 103 | |
| 104 | func makeCmdRepoList() *commander.Command { |
| 105 | cmd := &commander.Command{ |
no test coverage detected