func run()

in cmd/tfengine/main.go [50:89]


func run() error {
	flag.Parse()

	if *showVersion {
		cmd.ShowVersion()
		return nil
	}

	if *configPath == "" {
		return fmt.Errorf("--config_path must be set")
	}
	if *outputPath == "" {
		return fmt.Errorf("--output_path must be set")
	}

	cacheDir, err := ioutil.TempDir("", "")
	if err != nil {
		return fmt.Errorf("create temp dir: %v", err)
	}
	defer os.RemoveAll(cacheDir)

	wantedTemplates := make(map[string]bool)
	for _, t := range strings.Split(*templates, ",") {
		t = strings.TrimSpace(t)
		if len(t) > 0 {
			wantedTemplates[t] = true
		}
	}

	opts := &tfengine.Options{
		Format:          *format,
		AddLicenses:     *addLicenses,
		CacheDir:        cacheDir,
		WantedTemplates: wantedTemplates,
		ShowUnmanaged:   *showUnmanaged,
		DeleteUnmanaged: *deleteUnmanaged,
	}

	return tfengine.Run(*configPath, *outputPath, opts)
}