Fixes #79 When yaml is written automatically flatten was not included.
diff --git a/cmd/yaml.go b/cmd/yaml.go
index 92995ba..8bc3dcc 100644
--- a/cmd/yaml.go
+++ b/cmd/yaml.go
@@ -108,6 +108,10 @@
rootMap["incmd"] = yaml.Scalar(cfg.InCommand)
}
+ if cfg.Flatten == true {
+ rootMap["flatten"] = yaml.Scalar("true")
+ }
+
if overwrite {
// Imports
imports := make([]yaml.Node, len(cfg.Imports))
@@ -377,12 +381,15 @@
// ToYaml returns a yaml.Map containing the data from Config.
func (c *Config) ToYaml() yaml.Node {
- cfg := make(map[string]yaml.Node, 4)
+ cfg := make(map[string]yaml.Node, 5)
cfg["package"] = yaml.Scalar(c.Name)
if len(c.InCommand) > 0 {
cfg["incmd"] = yaml.Scalar(c.InCommand)
}
+ if c.Flatten == true {
+ cfg["flatten"] = yaml.Scalar("true")
+ }
imps := make([]yaml.Node, len(c.Imports))
for i, imp := range c.Imports {
@@ -478,7 +485,7 @@
// ToYaml converts a *Dependency to a YAML Map node.
func (d *Dependency) ToYaml() yaml.Node {
- dep := make(map[string]yaml.Node, 5)
+ dep := make(map[string]yaml.Node, 8)
dep["package"] = yaml.Scalar(d.Name)
if len(d.Subpackages) > 0 {
@@ -515,6 +522,12 @@
dep["os"] = yaml.List(oses)
}
+ // Note, the yaml package we use sorts strings of scalars so flatten
+ // will always be the top item.
+ if d.Flatten == true {
+ dep["flatten"] = yaml.Scalar("true")
+ }
+
return yaml.Map(dep)
}