package main

import (
	"os"

	"github.com/spf13/cobra"
)

var cfgPath string

func main() {
	root := &cobra.Command{
		Use:   "mcdeploy",
		Short: "Metacircular deployment tool",
	}
	root.PersistentFlags().StringVarP(&cfgPath, "config", "c", "mcdeploy.toml", "config file path")

	root.AddCommand(buildCommand())
	root.AddCommand(pushCommand())
	root.AddCommand(deployCommand())
	root.AddCommand(certCommand())
	root.AddCommand(statusCommand())

	if err := root.Execute(); err != nil {
		os.Exit(1)
	}
}

func loadCfg() (*Config, error) {
	return LoadConfig(cfgPath)
}
