2021-04-09 01:55:10 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cupcakearmy/autorestic/internal"
|
2021-04-12 16:15:17 +02:00
|
|
|
"github.com/cupcakearmy/autorestic/internal/colors"
|
2021-04-11 17:02:34 +02:00
|
|
|
"github.com/cupcakearmy/autorestic/internal/lock"
|
2021-04-09 01:55:10 +02: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 12:32:35 +01:00
|
|
|
internal.GetConfig()
|
2021-04-11 17:02:34 +02:00
|
|
|
err := lock.Lock()
|
|
|
|
CheckErr(err)
|
|
|
|
defer lock.Unlock()
|
|
|
|
|
2021-04-16 22:02:25 +02:00
|
|
|
CheckErr(internal.CheckConfig())
|
|
|
|
|
2021-04-23 19:19:03 +02:00
|
|
|
colors.Success.Println("Everything is fine.")
|
2021-04-09 01:55:10 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(checkCmd)
|
|
|
|
}
|