33 lines
674 B
Go
33 lines
674 B
Go
/*
|
|
Copyright © 2025 Jake jake.young.dev@gmail.com
|
|
*/
|
|
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"code.jakeyoungdev.com/jake/mctl/database"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// clearCmd represents the clear command
|
|
var clearCmd = &cobra.Command{
|
|
Use: "clear",
|
|
Short: "Clear config file",
|
|
Long: `Clears all configuration values for mctl. [WARNING] all server configuration will be lost`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
db, err := database.New()
|
|
cobra.CheckErr(err)
|
|
defer db.Close()
|
|
|
|
err = db.Destroy()
|
|
cobra.CheckErr(err)
|
|
|
|
fmt.Println("Configuration is cleared, the 'config' command must be run again.")
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(clearCmd)
|
|
}
|