/* * SPDX-License-Identifier: AGPL-3.0-only * Copyright (c) 2022-2024, daeuniverse Organization */ package cmd import ( "fmt" "os" "github.com/spf13/cobra" ) var ( validateCmd = &cobra.Command{ Use: "validate", Short: "To validate dae config.", Run: func(cmd *cobra.Command, args []string) { if cfgFile == "" { fmt.Println("Argument \"--config\" or \"-c\" is required but not provided.") os.Exit(1) } // Read config from --config cfgFile. _, _, err := readConfig(cfgFile) if err != nil { fmt.Println(err) os.Exit(1) } }, } ) func init() { rootCmd.AddCommand(validateCmd) validateCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file") }