lots o progress

- added 'command' subcommand
- removed viper
- setup commands added
- still a WIP
- readme TODO update
This commit is contained in:
2025-06-17 23:12:49 -04:00
parent 77bb3166c4
commit fe37cac2da
25 changed files with 456 additions and 488 deletions

32
cmd/destroy.go Normal file
View File

@@ -0,0 +1,32 @@
/*
Copyright © 2025 Jake jake.young.dev@gmail.com
*/
package cmd
import (
"fmt"
"code.jakeyoungdev.com/jake/mctl/database"
"github.com/spf13/cobra"
)
// destroyCmd represents the destroy command
var destroyCmd = &cobra.Command{
Use: "destroy",
// Short: "Clear all configuration",
// 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 'init' command must be run again.")
},
}
func init() {
rootCmd.AddCommand(destroyCmd)
}