From a6cf8eb381391f209ee15b40395603bec87479f3 Mon Sep 17 00:00:00 2001 From: Ghanil Date: Tue, 28 Nov 2023 19:29:14 +0800 Subject: [PATCH] add flags to pass dry run during sync --- cmd/sync.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/sync.go b/cmd/sync.go index f45569a9..be314ae9 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -34,6 +34,7 @@ func newSyncCmd() *cobra.Command { cmd.Flags().StringArrayP("file", "f", []string{"apisix.yaml"}, "configuration file path") cmd.Flags().BoolP("partial", "p", false, "partial apply mode. In partial mode, only add and update event will be applied.") + cmd.Flags().BoolP("dryRun", "d", false, "dry run mode. In dry run mode, no configuration will be applied.") return cmd } @@ -148,6 +149,12 @@ func sync(cmd *cobra.Command, dryRun bool) error { return nil } + dryRun, err = cmd.Flags().GetBool("dryRun") + if err != nil { + color.Red("Failed to get dry run option: %v", err) + return err + } + partial := false if !dryRun {