28 lines
483 B
Go
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)
|
|
}
|