mctl/cmd/root.go
jake fe37cac2da lots o progress
- added 'command' subcommand
- removed viper
- setup commands added
- still a WIP
- readme TODO update
2025-06-17 23:12:49 -04:00

39 lines
1018 B
Go

/*
Copyright © 2025 Jake jake.young.dev@gmail.com
*/
package cmd
import (
"os"
"code.jakeyoungdev.com/jake/mctl/cmd/command"
srv "code.jakeyoungdev.com/jake/mctl/cmd/server"
"github.com/spf13/cobra"
)
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "mctl",
Short: "A remote console client",
Long: `mctl is a terminal-friendly remote console client made to manage game servers.`,
Version: "v0.3.4",
// Run: func(cmd *cobra.Command, args []string) { },
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
rootCmd.CompletionOptions = cobra.CompletionOptions{
DisableDefaultCmd: true,
}
rootCmd.AddCommand(srv.ServerCmd)
rootCmd.AddCommand(command.CommandCmd) //the word command is in this four times, that can't be good.
}