no more init() and package level config.

This commit is contained in:
Erik Brakkee 2026-05-26 23:15:59 +02:00
parent ed4f75a93d
commit e99348c66d

View File

@ -30,7 +30,8 @@ func newConfig() *config {
return &config{} return &config{}
} }
var rootCmd = &cobra.Command{ func main() {
rootCmd := &cobra.Command{
Use: "bridge", Use: "bridge",
Short: "ANT+ to Bluetooth LE bridge", Short: "ANT+ to Bluetooth LE bridge",
Long: `Bridge an ANT+ cycling power trainer over Bluetooth Low Energy. Long: `Bridge an ANT+ cycling power trainer over Bluetooth Low Energy.
@ -76,13 +77,9 @@ This allows these trainers to be used with modern devices that don't support ANT
}, },
} }
func init() {
rootCmd.Flags().String("vendor", "0x0fcf", "USB vendor ID (hex, e.g. 0x0fcf)") rootCmd.Flags().String("vendor", "0x0fcf", "USB vendor ID (hex, e.g. 0x0fcf)")
rootCmd.Flags().String("product", "0x1008", "USB product ID (hex, e.g. 0x1008)") rootCmd.Flags().String("product", "0x1008", "USB product ID (hex, e.g. 0x1008)")
rootCmd.Flags().String("device", "3001", "ANT+ device number (hex or decimal, e.g. 3001 or 0xbb9)") rootCmd.Flags().String("device", "3001", "ANT+ device number (hex or decimal, e.g. 3001 or 0xbb9)")
}
func main() {
if err := rootCmd.Execute(); err != nil { if err := rootCmd.Execute(); err != nil {
os.Exit(1) os.Exit(1)
} }