cmd/edit.go
func EditCmd() *cobra.Command {
	var eo = &cli.EditOptions{}
	var editCmd = &cobra.Command{
		Use:   "edit <NAME>",
		Short: "Edit a cluster state",
		Long:  `Use this command to edit a state.`,
		Run: func(cmd *cobra.Command, args []string) {
			switch len(args) {
			case 0:
				eo.Name = viper.GetString(keyKubicornName)
			case 1:
				eo.Name = args[0]
			default:
				logger.Critical("Too many arguments.")
				os.Exit(1)
			}

			if err := runEdit(eo); err != nil {
				logger.Critical(err.Error())
				os.Exit(1)
			}

		},
	}

	fs := editCmd.Flags()

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

	fs.StringVarP(&eo.Editor, keyEditor, "e", viper.GetString(keyEditor), descEditor)
	fs.StringVar(&eo.GitRemote, keyGitConfig, viper.GetString(keyGitConfig), descGitConfig)

	return editCmd
}
func EditCmd() *cobra.Command {
	var eo = &cli.EditOptions{}
	var editCmd = &cobra.Command{
		Use:   "edit <NAME>",
		Short: "Edit a cluster state",
		Long:  `Use this command to edit a state.`,
		Run: func(cmd *cobra.Command, args []string) {
			switch len(args) {
			case 0:
				eo.Name = viper.GetString(keyKubicornName)
			case 1:
				eo.Name = args[0]
			default:
				logger.Critical("Too many arguments.")
				os.Exit(1)
			}

			if err := runEdit(eo); err != nil {
				logger.Critical(err.Error())
				os.Exit(1)
			}

		},
	}

	fs := editCmd.Flags()

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

	fs.StringVarP(&eo.Editor, keyEditor, "e", viper.GetString(keyEditor), descEditor)
	fs.StringVar(&eo.GitRemote, keyGitConfig, viper.GetString(keyGitConfig), descGitConfig)

	return editCmd
}
// EditCmd represents edit command