diff --git a/apps/piquelctl/src/editing/services.rs b/apps/piquelctl/src/editing/services.rs index 24c124048..c74094bc6 100644 --- a/apps/piquelctl/src/editing/services.rs +++ b/apps/piquelctl/src/editing/services.rs @@ -154,35 +154,40 @@ pub(crate) struct AddServiceArgs { target: ServiceTarget, #[command(flatten)] source: NewSource, - // Boxed to keep the CLI command enum small. - #[command(flatten)] - build: Box, } -// Where a new service's image comes from: exactly one of an image or `--git`. +// Where a new service's image comes from: exactly one of an image or `--git`, +// with the build settings only alongside `--git`. #[derive(Debug, Args)] struct NewSourceFlags { /// Image to run, such as `nginx:stable`. It may reference variables. /// Omit it when you pass `--git`. - #[arg(required_unless_present = "git", conflicts_with = "git")] + // The image also conflicts with the build settings, the `GitBuildArgs` + // group: clap skips their `requires = "git"` once an argument conflicting + // with `--git` is present. + #[arg(required_unless_present = "git", conflicts_with_all = ["git", "GitBuildArgs"])] image: Option