package cmd

import (
	"gadmin/internal/jsonc"
	"os"

	"github.com/sirupsen/logrus"
	"github.com/spf13/cobra"
)

var jsonCmd = &cobra.Command{
	Use:   "jsonc",
	Short: "根据传入版本号，更新gadmin服务所需的json配置文件",
	Run: func(cmd *cobra.Command, args []string) {
		logrus.Info("jsonc called")
		version := os.Getenv("JSON_VERSION")
		if len(args) > 0 {
			version = args[0]
		}
		jsonc.Run(version)
	},
}

func init() {
	rootCmd.AddCommand(jsonCmd)
}
