We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ExecOption
WithIIfOpt(cond, true_opt, false_opt)
WithIfOpt(cond, true_opt)
1 parent 6829220 commit 9cb84acCopy full SHA for 9cb84ac
exec_withopts.go
@@ -783,3 +783,20 @@ func WithGlobalPostActions(fns ...Invoker) ExecOption {
783
w.postActions = append(w.postActions, fns...)
784
}
785
786
+
787
+func WithIfOpt(condition bool, yes func() ExecOption) ExecOption {
788
+ return WithIIfOpt(condition, yes, nil)
789
+}
790
791
+func WithIIfOpt(condition bool, yes, no func() ExecOption) ExecOption {
792
+ if condition {
793
+ if yes != nil {
794
+ return yes()
795
+ }
796
+ } else {
797
+ if no != nil {
798
+ return no()
799
800
801
+ return nil
802
0 commit comments