// Command drover is the entry point for the Discord proxy CLI. package main import ( "fmt" "os" "github.com/spf13/cobra" ) // Build-time variables, populated via -ldflags "-X main.Version=... -X main.Commit=... -X main.BuildDate=...". var ( Version = "dev" Commit = "dev" BuildDate = "dev" ) // configPath is the path to the TOML config file, set via the --config global flag. // Reserved for use in later phases. var configPath string func main() { if err := newRootCmd().Execute(); err != nil { // Cobra already prints the error; just exit non-zero. os.Exit(1) } } func newRootCmd() *cobra.Command { root := &cobra.Command{ Use: "drover", Short: "Discord proxy via SOCKS5 + WinDivert", Version: fmt.Sprintf("%s (commit %s, built %s)", Version, Commit, BuildDate), SilenceUsage: true, SilenceErrors: false, } // Custom version template: "drover-go vX.Y.Z (commit abc1234, built 2026-05-01)". root.SetVersionTemplate(fmt.Sprintf("drover-go v%s (commit %s, built %s)\n", Version, Commit, BuildDate)) root.PersistentFlags().StringVar(&configPath, "config", "", "path to TOML config file (reserved)") root.AddCommand(newCheckCmd()) root.AddCommand(newUpdateCmd()) root.AddCommand(newServiceCmd()) return root } func newCheckCmd() *cobra.Command { return &cobra.Command{ Use: "check", Short: "Run the 7-step proxy diagnostic", RunE: func(cmd *cobra.Command, args []string) error { fmt.Fprintln(cmd.OutOrStdout(), "TODO: 7-step diagnostic") return nil }, } } func newUpdateCmd() *cobra.Command { var checkOnly bool cmd := &cobra.Command{ Use: "update", Short: "Self-update via the Forgejo Releases API", RunE: func(cmd *cobra.Command, args []string) error { fmt.Fprintln(cmd.OutOrStdout(), "TODO: update check") _ = checkOnly // wired up for the upcoming implementation return nil }, } cmd.Flags().BoolVar(&checkOnly, "check-only", false, "only check for an update, do not apply") return cmd } func newServiceCmd() *cobra.Command { cmd := &cobra.Command{ Use: "service", Short: "Manage the drover Windows service", } for _, name := range []string{"install", "uninstall", "start", "stop"} { name := name cmd.AddCommand(&cobra.Command{ Use: name, Short: fmt.Sprintf("%s the drover Windows service", name), RunE: func(cmd *cobra.Command, args []string) error { fmt.Fprintf(cmd.OutOrStdout(), "TODO: service %s\n", name) return nil }, }) } return cmd }