Skip to content

Commit

Permalink
Modify kubedb list command
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Sep 29, 2024
1 parent 4766a7b commit 75928cc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/cmds/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ func NewCmdListImages() *cobra.Command {
}

if lib.HasGroupKind(imgmap, schema.GroupKind{Group: "catalog.kubedb.com"}) {
if err = os.MkdirAll(filepath.Join(outDir, "images"), 0o755); err != nil {
return err
}

var rest []string
for key, list := range lib.GroupImages(imgmap) {
gk := schema.ParseGroupKind(key)
if gk.Group == "catalog.kubedb.com" {
sort.Strings(list)
err := write(list, filepath.Join(outDir, strings.ToLower(gk.Kind)+"s.yaml"))
err := write(list, filepath.Join(outDir, "images", strings.ToLower(gk.Kind)+"s.yaml"))
if err != nil {
return err
}
Expand All @@ -61,7 +65,10 @@ func NewCmdListImages() *cobra.Command {
}

sort.Strings(rest)
return write(rest, filepath.Join(outDir, "imagelist.yaml"))
err = write(rest, filepath.Join(outDir, "images", "operator.yaml"))
if err != nil {
return err
}
}

return write(lib.ListImages(imgmap), filepath.Join(outDir, "imagelist.yaml"))
Expand Down

0 comments on commit 75928cc

Please sign in to comment.