package sensor import ( "log" "git.cryptic.systems/fh-trier/go-flucky/pkg/config" "github.com/spf13/cobra" ) var disableSensorCmd = &cobra.Command{ Use: "disable", Short: "Disable Sensor", Args: cobra.ExactArgs(1), Example: "flucky sensor disable outdoor", Run: func(cmd *cobra.Command, args []string) { // read configuration fc, err := config.Read(cfg) if err != nil { log.Fatalln(err) } // disable sensor entry to list err = fc.DisableSensor(args[0]) if err != nil { log.Fatalln(err) } // save new configuration err = config.Write(fc, cfg) if err != nil { log.Fatalln(err) } }, } func init() { sensorCmd.AddCommand(disableSensorCmd) }