diff --git a/commands/previewPush.go b/commands/previewPush.go index f4317f95f..e18821b18 100644 --- a/commands/previewPush.go +++ b/commands/previewPush.go @@ -34,6 +34,7 @@ type PreviewArgs struct { GetCredentialsArgs FilterArgs Notify bool + WarnChanges bool } func (args *PreviewArgs) flags() []cli.Flag { @@ -45,6 +46,11 @@ func (args *PreviewArgs) flags() []cli.Flag { Destination: &args.Notify, Usage: `set to true to send notifications to configured destinations`, }) + flags = append(flags, cli.BoolFlag{ + Name: "expect-no-changes", + Destination: &args.WarnChanges, + Usage: `set to true for non-zero return code if there are changes`, + }) return flags } @@ -165,6 +171,9 @@ DomainLoop: if anyErrors { return errors.Errorf("Completed with errors") } + if totalCorrections != 0 && args.WarnChanges { + return errors.Errorf("There are pending changes") + } return nil }