breaktime/cmd/break.go
2023-03-31 11:07:03 -05:00

28 lines
483 B
Go

/*
Copyright © 2023 Brian Buller <brian@bullercodeworks.com>
*/
package cmd
import (
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// breakCmd represents the break command
var breakCmd = &cobra.Command{
Use: "break",
Short: "Start a break",
Run: func(cmd *cobra.Command, args []string) {
length := viper.GetDuration("breaklength")
viper.Set("lastbreak", time.Now().Add(length))
viper.WriteConfig()
},
}
func init() {
rootCmd.AddCommand(breakCmd)
}