mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Add -o flag to kustomize build
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
|||||||
|
|
||||||
type buildOptions struct {
|
type buildOptions struct {
|
||||||
kustomizationPath string
|
kustomizationPath string
|
||||||
|
outputPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newCmdBuild creates a new build command.
|
// newCmdBuild creates a new build command.
|
||||||
@@ -52,6 +53,10 @@ func newCmdBuild(out io.Writer, fs fs.FileSystem) *cobra.Command {
|
|||||||
return o.RunBuild(out, fs)
|
return o.RunBuild(out, fs)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
cmd.Flags().StringVarP(
|
||||||
|
&o.outputPath,
|
||||||
|
"output", "o", "",
|
||||||
|
"If specified, write the build output to this path.")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +103,10 @@ func (o *buildOptions) RunBuild(out io.Writer, fSys fs.FileSystem) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if o.outputPath != "" {
|
||||||
|
return fSys.WriteFile(o.outputPath, res)
|
||||||
|
}
|
||||||
_, err = out.Write(res)
|
_, err = out.Write(res)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user