autorestic/cmd/check.go

28 lines
557 B
Go
Raw Permalink Normal View History

2021-04-08 23:55:10 +00:00
package cmd
import (
"github.com/cupcakearmy/autorestic/internal"
2021-04-12 14:15:17 +00:00
"github.com/cupcakearmy/autorestic/internal/colors"
"github.com/cupcakearmy/autorestic/internal/lock"
2021-04-08 23:55:10 +00:00
"github.com/spf13/cobra"
)
var checkCmd = &cobra.Command{
Use: "check",
Short: "Check if everything is setup",
Run: func(cmd *cobra.Command, args []string) {
2021-11-23 11:32:35 +00:00
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
2021-04-16 20:02:25 +00:00
CheckErr(internal.CheckConfig())
2021-04-23 17:19:03 +00:00
colors.Success.Println("Everything is fine.")
2021-04-08 23:55:10 +00:00
},
}
func init() {
rootCmd.AddCommand(checkCmd)
}