MCPcopy Create free account
hub / github.com/aptly-dev/aptly / aptlyMirrorListJSON

Function aptlyMirrorListJSON

cmd/mirror_list.go:68–92  ·  view source on GitHub ↗
(_ *commander.Command, _ []string)

Source from the content-addressed store, hash-verified

66}
67
68func 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
94func makeCmdMirrorList() *commander.Command {
95 cmd := &commander.Command{

Callers 1

aptlyMirrorListFunction · 0.85

Calls 5

RemoteRepoCollectionMethod · 0.80
NewCollectionFactoryMethod · 0.80
CloseDatabaseMethod · 0.80
LenMethod · 0.45
ForEachMethod · 0.45

Tested by

no test coverage detected