package logger import ( "log" "git.cryptic.systems/fh-trier/go-flucky/pkg/config" "github.com/spf13/cobra" ) var rmLoggerCmd = &cobra.Command{ Use: "rm", Short: "Remove internal logger", Args: cobra.ExactArgs(1), Aliases: []string{"remove"}, Example: "flucky logger rm /var/log/flucky/temperature.log", Run: func(cmd *cobra.Command, args []string) { // read configuration fc, err := config.Read(cfg) if err != nil { log.Fatalln(err) } err = fc.RemoveLogFile(args[0]) if err != nil { log.Fatalln(err) } // save new configuration err = config.Write(fc, cfg) if err != nil { log.Fatalln(err) } }, } func init() { loggerCmd.AddCommand(rmLoggerCmd) }