cmd

package
v1.100.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "atmos",
	Short: "Universal Tool for DevOps and Cloud Automation",
	Long:  `Atmos is a universal tool for DevOps and cloud automation used for provisioning, managing and orchestrating workflows across various toolchains`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {

		isHelpCommand := cmd.Name() == "help"
		helpFlag := cmd.Flags().Changed("help")

		isHelpRequested := isHelpCommand || helpFlag

		if isHelpRequested {

			cmd.SilenceUsage = false
			cmd.SilenceErrors = false
		} else {
			cmd.SilenceUsage = true
			cmd.SilenceErrors = true
		}
	},
	Run: func(cmd *cobra.Command, args []string) {

		checkAtmosConfig()

		fmt.Println()
		err := tuiUtils.PrintStyledText("ATMOS")
		if err != nil {
			u.LogErrorAndExit(schema.CliConfiguration{}, err)
		}

		err = e.ExecuteAtmosCmd()
		if err != nil {
			u.LogErrorAndExit(schema.CliConfiguration{}, err)
		}
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var ValidateStacksCmd = &cobra.Command{
	Use:                "stacks",
	Short:              "Execute 'validate stacks' command",
	Long:               `This command validates stack manifest configurations: atmos validate stacks`,
	Example:            "validate stacks",
	FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
	Run: func(cmd *cobra.Command, args []string) {

		checkAtmosConfig()

		err := e.ExecuteValidateStacksCmd(cmd, args)
		if err != nil {
			u.LogErrorAndExit(schema.CliConfiguration{}, err)
		}

		u.PrintMessageInColor("all stacks validated successfully\n", color.New(color.FgGreen))
	},
}

ValidateStacksCmd validates stacks

Functions

func Execute

func Execute() error

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

Types

type AtmosValidateOption added in v1.97.0

type AtmosValidateOption func(*ValidateConfig)

func WithStackValidation added in v1.97.0

func WithStackValidation(check bool) AtmosValidateOption

type ValidateConfig added in v1.97.0

type ValidateConfig struct {
	CheckStack bool
}

ValidateConfig holds configuration options for Atmos validation. CheckStack determines whether stack configuration validation should be performed.

Jump to

Keyboard shortcuts

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