MCPcopy
hub / github.com/docker/compose / validateFlags

Function validateFlags

cmd/compose/up.go:190–229  ·  view source on GitHub ↗

nolint:gocyclo

(up *upOptions, create *createOptions)

Source from the content-addressed store, hash-verified

188
189//nolint:gocyclo
190func validateFlags(up *upOptions, create *createOptions) error {
191 if up.waitTimeout < 0 {
192 return fmt.Errorf("--wait-timeout must be a non-negative integer")
193 }
194 if up.exitCodeFrom != "" && !up.cascadeFail {
195 up.cascadeStop = true
196 }
197 if up.cascadeStop && up.cascadeFail {
198 return fmt.Errorf("--abort-on-container-failure cannot be combined with --abort-on-container-exit")
199 }
200 if up.wait {
201 if up.attachDependencies || up.cascadeStop || len(up.attach) > 0 {
202 return fmt.Errorf("--wait cannot be combined with --abort-on-container-exit, --attach or --attach-dependencies")
203 }
204 up.Detach = true
205 }
206 if create.Build && create.noBuild {
207 return fmt.Errorf("--build and --no-build are incompatible")
208 }
209 if up.Detach && (up.attachDependencies || up.cascadeStop || up.cascadeFail || len(up.attach) > 0 || up.watch) {
210 if up.wait {
211 return fmt.Errorf("--wait cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch")
212 } else {
213 return fmt.Errorf("--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch")
214 }
215 }
216 if create.noInherit && create.noRecreate {
217 return fmt.Errorf("--no-recreate and --renew-anon-volumes are incompatible")
218 }
219 if create.forceRecreate && create.noRecreate {
220 return fmt.Errorf("--force-recreate and --no-recreate are incompatible")
221 }
222 if create.recreateDeps && create.noRecreate {
223 return fmt.Errorf("--always-recreate-deps and --no-recreate are incompatible")
224 }
225 if create.noBuild && up.watch {
226 return fmt.Errorf("--no-build and --watch are incompatible")
227 }
228 return nil
229}
230
231//nolint:gocyclo
232func runUp(

Callers 1

upCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected