cmd/apply.go
func ApplyCmd() *cobra.Command {
	var ao = &cli.ApplyOptions{}
	var applyCmd = &cobra.Command{
		Use:   "apply <NAME>",
		Short: "Apply a cluster resource to a cloud",
		Long: `Use this command to apply an API model in a cloud.

	This command will attempt to find an API model in a defined state store, and then apply any changes needed directly to a cloud.
	The apply will run once, and ultimately time out if something goes wrong.`,
		Run: func(cmd *cobra.Command, args []string) {
			switch len(args) {
			case 0:
				ao.Name = viper.GetString(keyKubicornName)
			case 1:
				ao.Name = args[0]
			default:
				logger.Critical("Too many arguments.")
				os.Exit(1)
			}

			if err := runApply(ao); err != nil {
				logger.Critical(err.Error())
				os.Exit(1)
			}
		},
	}

	fs := applyCmd.Flags()

	bindCommonStateStoreFlags(&ao.StateStoreOptions, fs)
	bindCommonAwsFlags(&ao.AwsOptions, fs)

	fs.StringArrayVarP(&ao.Set, keyKubicornSet, "e", viper.GetStringSlice(keyKubicornSet), descSet)
	fs.StringVar(&ao.AwsProfile, keyAwsProfile, viper.GetString(keyAwsProfile), descAwsProfile)
	fs.StringVar(&ao.GitRemote, keyGitConfig, viper.GetString(keyGitConfig), descGitConfig)

	return applyCmd
}
func ApplyCmd() *cobra.Command {
	var ao = &cli.ApplyOptions{}
	var applyCmd = &cobra.Command{
		Use:   "apply <NAME>",
		Short: "Apply a cluster resource to a cloud",
		Long: `Use this command to apply an API model in a cloud.

	This command will attempt to find an API model in a defined state store, and then apply any changes needed directly to a cloud.
	The apply will run once, and ultimately time out if something goes wrong.`,
		Run: func(cmd *cobra.Command, args []string) {
			switch len(args) {
			case 0:
				ao.Name = viper.GetString(keyKubicornName)
			case 1:
				ao.Name = args[0]
			default:
				logger.Critical("Too many arguments.")
				os.Exit(1)
			}

			if err := runApply(ao); err != nil {
				logger.Critical(err.Error())
				os.Exit(1)
			}
		},
	}

	fs := applyCmd.Flags()

	bindCommonStateStoreFlags(&ao.StateStoreOptions, fs)
	bindCommonAwsFlags(&ao.AwsOptions, fs)

	fs.StringArrayVarP(&ao.Set, keyKubicornSet, "e", viper.GetStringSlice(keyKubicornSet), descSet)
	fs.StringVar(&ao.AwsProfile, keyAwsProfile, viper.GetString(keyAwsProfile), descAwsProfile)
	fs.StringVar(&ao.GitRemote, keyGitConfig, viper.GetString(keyGitConfig), descGitConfig)

	return applyCmd
}
// ApplyCmd represents the apply command