Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 1b54a38

Browse files
authored
Merge pull request #1766 from ndeloof/config_profiles
config --profiles to list all defined profiles
2 parents 4987a52 + 1ad9646 commit 1b54a38

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

cli/cmd/compose/convert.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"io"
2424
"os"
25+
"sort"
2526
"strings"
2627

2728
"github.com/cnabio/cnab-to-oci/remotes"
@@ -189,18 +190,23 @@ func runHash(opts convertOptions) error {
189190
}
190191

191192
func runProfiles(opts convertOptions, services []string) error {
192-
profiles := map[string]interface{}{}
193-
_, err := opts.toProject(services)
193+
set := map[string]struct{}{}
194+
project, err := opts.toProject(services)
194195
if err != nil {
195196
return err
196197
}
197-
if opts.projectOptions != nil {
198-
for _, p := range opts.projectOptions.Profiles {
199-
profiles[p] = nil
200-
}
201-
for p := range profiles {
202-
fmt.Println(p)
198+
for _, s := range project.AllServices() {
199+
for _, p := range s.Profiles {
200+
set[p] = struct{}{}
203201
}
204202
}
203+
profiles := make([]string, 0, len(set))
204+
for p := range set {
205+
profiles = append(profiles, p)
206+
}
207+
sort.Strings(profiles)
208+
for _, p := range profiles {
209+
fmt.Println(p)
210+
}
205211
return nil
206212
}

0 commit comments

Comments
 (0)