Commit 412d9294
412d9294a290Merged
zhilyaev <[email protected]> · 5 years ago · 5 files · ~5 modified
Description
auto Yaml
Details
- Commit
- 412d9294a290
- Parent
- 372f6121402d
pkg/action/build.gomodifiedView file
@@ -10,15 +10,24 @@
1010
)1111
1212
type Build struct {13-
plandir, ymlFile string14-
tags cli.StringSlice15-
matchAll bool16-
diffWide int13+
plandir string14+
tags cli.StringSlice15+
matchAll bool16+
diffWide int17+
18+
autoYml bool19+
yml Yml1720
}1821
1922
func (i *Build) Run() error {23+
if i.autoYml {24+
if err := i.yml.Run(); err != nil {25+
return err26+
}27+
}28+
2029
newPlan := plan.New(i.plandir)21-
err := newPlan.Build(i.ymlFile, i.normalizeTags(), i.matchAll)30+
err := newPlan.Build(i.yml.file, i.normalizeTags(), i.matchAll)2231
if err != nil {2332
return err2433
}@@ -52,17 +61,30 @@
5261
5362
func (i *Build) Cmd() *cli.Command {5463
return &cli.Command{55-
Name: "build",56-
Usage: "🏗 Build a plan",57-
Flags: []cli.Flag{58-
flagPlandir(&i.plandir),59-
flagTags(&i.tags),60-
flagMatchAllTags(&i.matchAll),61-
flagYmlFile(&i.ymlFile),62-
flagDiffWide(&i.diffWide),64+
Name: "build",65+
Usage: "🏗 Build a plan",66+
Flags: i.flags(),67+
Action: toCtx(i.Run),68+
}69+
}70+
71+
func (i *Build) flags() []cli.Flag {72+
self := []cli.Flag{73+
flagPlandir(&i.plandir),74+
flagTags(&i.tags),75+
flagMatchAllTags(&i.matchAll),76+
flagDiffWide(&i.diffWide),77+
78+
&cli.BoolFlag{79+
Name: "yml",80+
Usage: "Auto helmwave.yml.tpl --> helmwave.yml",81+
Value: false,82+
EnvVars: []string{"HELMWAVE_AUTO_YML", "HELMWAVE_AUTO_YAML"},83+
Destination: &i.autoYml,6384
},64-
Action: toCtx(i.Run),6585
}86+
87+
return append(self, i.yml.flags()...)6688
}6789
6890
func (i *Build) normalizeTags() []string {pkg/action/diff.gomodifiedView file
Loading diff…
pkg/action/flags.gomodifiedView file
Loading diff…
pkg/action/yml.gomodifiedView file
Loading diff…
pkg/action/yml_test.gomodifiedView file
Loading diff…