cmd/errors.go   A
last analyzed

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 12
dl 0
loc 20
rs 10
c 0
b 0
f 0
1
package cmd
2
3
import (
4
	"github.com/SerhiiCho/shoshka-go/telegram"
5
6
	"github.com/spf13/cobra"
7
)
8
9
var errorsCmd = &cobra.Command{
10
	Use:   "errors",
11
	Short: "Checks error log file in provided path, if there are new errors added to it it will send a telegram message to a certain chat.",
12
	Run: func(cmd *cobra.Command, args []string) {
13
		for _, msg := range telegram.GetMessagesWithNewErrors() {
14
			telegram.SendMessage(msg)
15
		}
16
	},
17
}
18
19
func init() {
20
	rootCmd.AddCommand(errorsCmd)
21
}
22