Skip to content

Commit

Permalink
add flags to pass dry run during sync
Browse files Browse the repository at this point in the history
  • Loading branch information
neil85 committed Nov 28, 2023
1 parent 7c8f976 commit a6cf8eb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -148,6 +149,12 @@ func sync(cmd *cobra.Command, dryRun bool) error {
return nil
}

dryRun, err = cmd.Flags().GetBool("dryRun")

Check failure on line 152 in cmd/sync.go

View workflow job for this annotation

GitHub Actions / lint

SA4009(related information): assignment to dryRun (staticcheck)
if err != nil {
color.Red("Failed to get dry run option: %v", err)
return err
}

partial := false

if !dryRun {
Expand Down

0 comments on commit a6cf8eb

Please sign in to comment.