github.com/Azure/draft@v0.16.0/pkg/draft/pack/list.go (about) 1 package pack 2 3 import ( 4 "github.com/Azure/draft/pkg/draft/pack/repo" 5 ) 6 7 // List returns a list of all pack names found in the specified repository or error. 8 // 9 // If repoName == "", List returns the set of all packs aggregated across all repositories. 10 func List(packsDir, repoName string) ([]string, error) { 11 var packs []string 12 for _, r := range repo.FindRepositories(packsDir) { 13 if repoName != "" && repoName != r.Name { 14 continue 15 } 16 all, err := r.List() 17 if err != nil { 18 return packs, err 19 } 20 packs = append(packs, all...) 21 } 22 return packs, nil 23 }