package commands

import (
	"fmt"

	"github.com/spf13/cobra"
)

func init() {
	stopCmd.Flags().BoolP("clean", "c", false, "remove data volumes to clear the localdev db")
}

var stopCmd = &cobra.Command{
	Use:   "stop",
	Short: "stop the dev environment",
	Example: `
	localdev stop
	localdev stop --clean`,
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		clean, err := cmd.Flags().GetBool("clean")
		if err != nil {
			return err
		}

		err = stopLocaldev(cmd, clean)
		if err != nil {
			return err
		}

		fmt.Fprintln(cmd.OutOrStdout(), "all done!")

		return nil

	},
}
