44 "context"
55 "fmt"
66 "github.com/loft-sh/devspace/pkg/devspace/config"
7+ "github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
78 devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
89 "github.com/loft-sh/devspace/pkg/devspace/dependency"
910 "github.com/loft-sh/devspace/pkg/devspace/dependency/types"
@@ -27,8 +28,9 @@ import (
2728type PrintCmd struct {
2829 * flags.GlobalFlags
2930
30- Out io.Writer
31- SkipInfo bool
31+ Out io.Writer
32+ StripNames bool
33+ SkipInfo bool
3234
3335 Dependency string
3436}
@@ -37,6 +39,7 @@ type PrintCmd struct {
3739func NewPrintCmd (f factory.Factory , globalFlags * flags.GlobalFlags ) * cobra.Command {
3840 cmd := & PrintCmd {
3941 GlobalFlags : globalFlags ,
42+ StripNames : true ,
4043 Out : os .Stdout ,
4144 }
4245
@@ -117,7 +120,7 @@ func (cmd *PrintCmd) Run(f factory.Factory) error {
117120 ctx = ctx .AsDependency (dep )
118121 }
119122
120- bsConfig , err := yaml . Marshal (ctx .Config ().Config ())
123+ bsConfig , err := marshalConfig (ctx .Config ().Config (), cmd . StripNames )
121124 if err != nil {
122125 return err
123126 }
@@ -141,6 +144,41 @@ func (cmd *PrintCmd) Run(f factory.Factory) error {
141144 return nil
142145}
143146
147+ func marshalConfig (config * latest.Config , stripNames bool ) ([]byte , error ) {
148+ // remove the auto generated names
149+ if stripNames {
150+ for k := range config .Images {
151+ config .Images [k ].Name = ""
152+ }
153+ for k := range config .Deployments {
154+ config .Deployments [k ].Name = ""
155+ }
156+ for k := range config .Dependencies {
157+ config .Dependencies [k ].Name = ""
158+ }
159+ for k := range config .Pipelines {
160+ config .Pipelines [k ].Name = ""
161+ }
162+ for k := range config .Dev {
163+ config .Dev [k ].Name = ""
164+ for c := range config .Dev [k ].Containers {
165+ config .Dev [k ].Containers [c ].Container = ""
166+ }
167+ }
168+ for k := range config .Vars {
169+ config .Vars [k ].Name = ""
170+ }
171+ for k := range config .PullSecrets {
172+ config .PullSecrets [k ].Name = ""
173+ }
174+ for k := range config .Commands {
175+ config .Commands [k ].Name = ""
176+ }
177+ }
178+
179+ return yaml .Marshal (config )
180+ }
181+
144182func printExtraInfo (config config.Config , dependencies []types.Dependency , log logger.Logger ) error {
145183 log .WriteString (logrus .InfoLevel , "\n -------------------\n \n Vars:\n " )
146184
0 commit comments