package sensor import ( "fmt" "github.com/spf13/cobra" ) var enabled bool var sensorLocation, wireID, wirePath string var addSensorCmd = &cobra.Command{ Use: "add", Short: "Add Sensor", Args: cobra.ExactArgs(3), Example: fmt.Sprintf("flucky sensor add indoor dht11 14\nflucky sensor add --wire-id 28-011432f0bb3d outdoor ds18b20 14"), } func init() { sensorCmd.AddCommand(addSensorCmd) addSensorCmd.Flags().BoolVarP(&enabled, "enabled", "e", true, "Enable Sensor") addSensorCmd.Flags().StringVarP(&sensorLocation, "sensor-location", "l", "", "Sensor location") addSensorCmd.Flags().StringVarP(&wireID, "wire-id", "i", "", "Wire-ID") addSensorCmd.Flags().StringVarP(&wirePath, "wire-path", "w", "/sys/bus/w1/devices", "Wire device path") }