Skip to content

Commit

Permalink
Handle if "binary" flag is not set (is empty)
Browse files Browse the repository at this point in the history
Set `kustomize` as default
  • Loading branch information
ioboi committed May 30, 2024
1 parent fdb3bc5 commit efb7cdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/kustomize.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"cmp"
"fmt"
"os/exec"

Expand All @@ -25,10 +26,8 @@ var kustomizeCmd = &cobra.Command{
},
Long: `Generate a DOT file to visualize the dependencies between your kustomize components`,
RunE: func(cmd *cobra.Command, args []string) error {
kustomizeCmd := "kustomize"
if *binary != "" {
kustomizeCmd = *binary
}

kustomizeCmd := cmp.Or(*binary, "kustomize")

if *version {
kustomizeCmd := exec.CommandContext(cmd.Context(), kustomizeCmd, "version")
Expand Down
5 changes: 5 additions & 0 deletions cmd/kustomize/build.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package kustomize

import (
"cmp"

"github.com/puzzle/goff/kustomize"

"github.com/spf13/cobra"
Expand All @@ -24,6 +26,9 @@ var KustomizeBuildCmd = &cobra.Command{
if err != nil {
return err
}

kustomizeCommand = cmp.Or(kustomizeCommand, "kustomize")

return kustomize.BuildAll(kustomizeCommand, args[0], *outputBuildDir)
},
}
Expand Down

0 comments on commit efb7cdb

Please sign in to comment.