commands

package
Version: v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, dupl

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, unparam

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, unparam

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, unparam

Package commands process flags/environment variables/config file. It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, unparam

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, unparam

Package commands process flags/environment variables/config file It contains global variables with configs and commands nolint: gochecknoglobals, gochecknoinits, dupl

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "caldera",
	Short: "A service boilerplate generator",
	Long: `In this mode, you'll be asked about the general
properties associated with the new service.
The configuration file will be used for all other data,
such as the host, port, etc., if you have saved it before.
Otherwise, the default settings will be used.`,
	Run: func(cmd *cobra.Command, args []string) {
		cfg := new(config.Config)
		if err := viper.Unmarshal(&cfg); err != nil {
			fmt.Println("Error parsing of configuration, used default:", err)
		}
		cfg = input.Inquire(cfg)
		if cfg.Storage.MySQL &&
			cfg.Storage.Config.Port == config.DefaultPostgresPort {
			cfg.Storage.Config.Driver = config.StorageMySQL
			cfg.Storage.Config.Host = config.StorageMySQL
			cfg.Storage.Config.Port = config.DefaultMySQLPort
			cfg.Storage.Config.Username = config.StorageMySQL
			cfg.Storage.Config.Password = config.StorageMySQL
		}
		if cfg.Storage.Postgres &&
			cfg.Storage.Config.Port == config.DefaultMySQLPort {
			cfg.Storage.Config.Driver = config.StoragePostgres
			cfg.Storage.Config.Host = config.StoragePostgres
			cfg.Storage.Config.Port = config.DefaultPostgresPort
			cfg.Storage.Config.Username = config.StoragePostgres
			cfg.Storage.Config.Password = config.StoragePostgres
		}
		generator.Run(cfg)
	},
}

RootCmd represents the base command when called without any subcommands.

Functions

func Run

func Run()

Run adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL