From 8a9d271cf956b33788a59ce05e9bd796b1745560 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 11 Feb 2024 23:01:21 +0100 Subject: [PATCH] allow skipping validation in [update] --- cmd/update/update.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/update/update.go b/cmd/update/update.go index 4a0e9f3..0671f20 100644 --- a/cmd/update/update.go +++ b/cmd/update/update.go @@ -25,6 +25,7 @@ func Command() *cobra.Command { cmd.Flags().String("source", "", "URL or local file path to the upstream source file. This will take precedence over any [@dottie/source] annotation in the file") shared.BoolWithInverse(cmd, "error-on-missing-key", true, "Error if a KEY in FILE is missing from SOURCE", "Add KEY to FILE if missing from SOURCE") + shared.BoolWithInverse(cmd, "validate", true, "Validation errors will abort the update", "Validation errors will be printed but will not fail the update") return cmd } @@ -231,7 +232,7 @@ func runE(cmd *cobra.Command, args []string) error { dark.Println() - if sawError { + if sawError && shared.BoolWithInverseValue(cmd.Flags(), "validate") { return errors.New("some fields failed validation, aborting ...") }