Files
charts/clustertool/cmd/adv_precommit.go
2024-10-25 18:29:29 +02:00

32 lines
687 B
Go

package cmd
import (
"os"
"strings"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/truecharts/public/clustertool/pkg/sops"
)
var advPrecommitLongHelp = strings.TrimSpace(`
`)
var precommit = &cobra.Command{
Use: "precommit",
Short: "Runs the PreCommit encryption check",
Example: "clustertool adv precommit",
Long: advPrecommitLongHelp,
Run: func(cmd *cobra.Command, args []string) {
if err := sops.CheckFilesAndReportEncryption(true, true); err != nil {
log.Info().Msgf("Error checking files: %v\n", err)
os.Exit(1)
}
},
}
func init() {
adv.AddCommand(precommit)
}