Skip to content

Commit

Permalink
Fix 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 23, 2024
1 parent 68ca034 commit 0b56376
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ import (
)

func main() {
if err := realMain(); err != nil {
os.Exit(1)
}
}

func realMain() error {
rootCmd := cmds.NewRootCmd()
logs.Init(rootCmd, false)
defer logs.FlushLogs()

if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
return rootCmd.Execute()
}
2 changes: 1 addition & 1 deletion pkg/cmds/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewCmdListImages() *cobra.Command {
}

cmd.Flags().StringVar(&rootDir, "root-dir", "", "Root directory")
cmd.Flags().StringVar(&rootDir, "output-dir", "", "Output directory")
cmd.Flags().StringVar(&outDir, "output-dir", "", "Output directory")
_ = cobra.MarkFlagRequired(cmd.Flags(), "root-dir")
_ = cobra.MarkFlagRequired(cmd.Flags(), "output-dir")

Expand Down
8 changes: 7 additions & 1 deletion pkg/lib/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package lib

import (
"os"
"path/filepath"
"sort"
"strings"

Expand All @@ -43,7 +44,12 @@ func ListImages(rootDir string) ([]string, error) {
continue
}

out, err := sh.Command("helm", "template", entry.Name()).Output()
err := sh.SetDir(filepath.Join(rootDir, entry.Name())).Command("helm", "dependency", "build").Run()
if err != nil {
panic(err)
}

out, err := sh.SetDir(rootDir).Command("helm", "template", entry.Name()).Output()
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 0b56376

Please sign in to comment.