CreateOptions.Recreate and RecreateDependencies are strings, and any value
other than force or never silently behaved like diverged: a typo such as
"forced" was accepted and did the opposite of what the caller meant.
Add CreateOptions.Validate, which rejects such values with an
InvalidOptionError matching the new ErrInvalidOption, and call it from
Create and, through UpOptions.Validate, from Up, before anything is
touched. The empty string keeps meaning diverged, and the Recreate*
constants are unchanged, so existing callers are not affected.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
The CLI refuses combinations such as --wait with --attach, or --detach with
--abort-on-container-exit, --exit-code-from or --watch. The library did not:
an integrator setting Start.Wait together with Start.Attach got an
interactive session in which the wait was silently dropped, and the
session-only options were silently ignored when Attach is nil.
Add UpOptions.Validate, called first thing by Up, which returns an
*IncompatibleOptionsError matching api.ErrIncompatibleOptions. The CLI is
unchanged.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>