cmd

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package cmd defines all the commands that Terracognita supports

Index

Constants

This section is empty.

Variables

View Source
var (

	// RootCmd it's the entry command for the cmd on terracognita
	RootCmd = &cobra.Command{
		Use:   "terracognita",
		Short: "Reads from Providers and generates a Terraform configuration",
		Long:  "Reads from Providers and generates a Terraform configuration, all the flags can be used also with ENV (ex: --aws-access-key == AWS_ACCESS_KEY)",
		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
			err := os.MkdirAll(path.Dir(viper.GetString("log-file")), 0700)
			if err != nil {
				return err
			}
			logFile, err := os.OpenFile(viper.GetString("log-file"), os.O_APPEND|os.O_TRUNC|os.O_RDWR|os.O_CREATE, 0644)
			if err != nil {
				return err
			}
			closeOut = append(closeOut, logFile)

			if viper.GetBool("verbose") || viper.GetBool("debug") {
				logsOut = ioutil.Discard
				w := io.MultiWriter(os.Stdout, logFile)
				log.Init(w, viper.GetBool("debug"))
			} else {
				logsOut = os.Stdout
				log.Init(logFile, false)
			}

			return nil
		},
	}
)
View Source
var (
	// Version is the value of the current verion, this
	// is set via -ldflags
	Version string
)

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