breaktime/cmd/stop.go

28 lines
476 B
Go

/*
Copyright © 2023 Brian Buller <brian@bullercodeworks.com>
*/
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// stopCmd represents the stop command
var stopCmd = &cobra.Command{
Use: "stop",
Short: "Stop the timer",
Run: func(cmd *cobra.Command, args []string) {
viper.Set("active", false)
viper.WriteConfig()
if !hasArg("-s", args) {
fmt.Println("Timer Stopped.")
}
},
}
func init() { rootCmd.AddCommand(stopCmd) }