merge

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:                   "merge <template> <template> ...",
	Short:                 "Merge two or more CloudFormation templates",
	Long:                  "Merges all specified CloudFormation templates, print the resultant template to standard out",
	Args:                  cobra.MinimumNArgs(2),
	DisableFlagsInUseLine: true,
	Run: func(cmd *cobra.Command, args []string) {
		var err error

		templates := make([]cft.Template, len(args))

		for i, fn := range args {
			templates[i], err = parse.File(fn)
			if err != nil {
				panic(ui.Errorf(err, "unable to open template '%s'", fn))
			}
		}

		var merged cft.Template

		for i, template := range templates {
			if i == 0 {
				merged = template
				continue
			}

			merged, err = mergeTemplates(merged, template)
			if err != nil {
				panic(err)
			}
		}

		fmt.Println(format.String(merged, format.Options{}))
	},
}

Cmd is the merge command's entrypoint

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL