Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmd/compose/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@

"github.com/compose-spec/compose-go/v2/types"
"github.com/docker/cli/cli/command"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/docker/compose/v2/pkg/api"
)
Expand Down Expand Up @@ -81,7 +83,15 @@
flags.BoolVar(&opts.noRecreate, "no-recreate", false, "If containers already exist, don't recreate them. Incompatible with --force-recreate.")
flags.BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file")
flags.StringArrayVar(&opts.scale, "scale", []string{}, "Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.")
flags.BoolVarP(&opts.AssumeYes, "y", "y", false, `Assume "yes" as answer to all prompts and run non-interactively`)
flags.BoolVarP(&opts.AssumeYes, "yes", "y", false, `Assume "yes" as answer to all prompts and run non-interactively`)
flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
// assumeYes was introduced by mistake as `--y`
if name == "y" {
logrus.Warn("--y is deprecated, please use --yes instead")
name = "yes"
}

Check warning on line 92 in cmd/compose/create.go

View check run for this annotation

Codecov / codecov/patch

cmd/compose/create.go#L90-L92

Added lines #L90 - L92 were not covered by tests
return pflag.NormalizedName(name)
})
return cmd
}

Expand Down
12 changes: 11 additions & 1 deletion cmd/compose/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"errors"

"github.com/docker/cli/cli/command"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/docker/compose/v2/pkg/api"
)
Expand Down Expand Up @@ -50,7 +52,15 @@
flags.BoolVar(&opts.resolveImageDigests, "resolve-image-digests", false, "Pin image tags to digests")
flags.StringVar(&opts.ociVersion, "oci-version", "", "OCI image/artifact specification version (automatically determined by default)")
flags.BoolVar(&opts.withEnvironment, "with-env", false, "Include environment variables in the published OCI artifact")
flags.BoolVarP(&opts.assumeYes, "y", "y", false, `Assume "yes" as answer to all prompts`)
flags.BoolVarP(&opts.assumeYes, "yes", "y", false, `Assume "yes" as answer to all prompts`)
flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
// assumeYes was introduced by mistake as `--y`
if name == "y" {
logrus.Warn("--y is deprecated, please use --yes instead")
name = "yes"
}

Check warning on line 61 in cmd/compose/publish.go

View check run for this annotation

Codecov / codecov/patch

cmd/compose/publish.go#L59-L61

Added lines #L59 - L61 were not covered by tests
return pflag.NormalizedName(name)
})

return cmd
}
Expand Down
13 changes: 11 additions & 2 deletions cmd/compose/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"github.com/compose-spec/compose-go/v2/types"
"github.com/docker/cli/cli/command"
xprogress "github.com/moby/buildkit/util/progress/progressui"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/docker/compose/v2/cmd/formatter"
"github.com/docker/compose/v2/pkg/api"
Expand Down Expand Up @@ -145,7 +147,6 @@
flags := upCmd.Flags()
flags.BoolVarP(&up.Detach, "detach", "d", false, "Detached mode: Run containers in the background")
flags.BoolVar(&create.Build, "build", false, "Build images before starting containers")
flags.BoolVarP(&create.AssumeYes, "y", "y", false, `Assume "yes" as answer to all prompts and run non-interactively`)
flags.BoolVar(&create.noBuild, "no-build", false, "Don't build an image, even if it's policy")
flags.StringVar(&create.Pull, "pull", "policy", `Pull image before running ("always"|"missing"|"never")`)
flags.BoolVar(&create.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file")
Expand All @@ -171,7 +172,15 @@
flags.IntVar(&up.waitTimeout, "wait-timeout", 0, "Maximum duration in seconds to wait for the project to be running|healthy")
flags.BoolVarP(&up.watch, "watch", "w", false, "Watch source code and rebuild/refresh containers when files are updated.")
flags.BoolVar(&up.navigationMenu, "menu", false, "Enable interactive shortcuts when running attached. Incompatible with --detach. Can also be enable/disable by setting COMPOSE_MENU environment var.")

flags.BoolVarP(&create.AssumeYes, "yes", "y", false, `Assume "yes" as answer to all prompts and run non-interactively`)
flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
// assumeYes was introduced by mistake as `--y`
if name == "y" {
logrus.Warn("--y is deprecated, please use --yes instead")
name = "yes"
}

Check warning on line 181 in cmd/compose/up.go

View check run for this annotation

Codecov / codecov/patch

cmd/compose/up.go#L179-L181

Added lines #L179 - L181 were not covered by tests
return pflag.NormalizedName(name)
})
return upCmd
}

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compose_alpha_publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Publish compose application
| `--oci-version` | `string` | | OCI image/artifact specification version (automatically determined by default) |
| `--resolve-image-digests` | `bool` | | Pin image tags to digests |
| `--with-env` | `bool` | | Include environment variables in the published OCI artifact |
| `-y`, `--y` | `bool` | | Assume "yes" as answer to all prompts |
| `-y`, `--yes` | `bool` | | Assume "yes" as answer to all prompts |


<!---MARKER_GEN_END-->
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compose_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Creates containers for a service
| `--quiet-pull` | `bool` | | Pull without printing progress information |
| `--remove-orphans` | `bool` | | Remove containers for services not defined in the Compose file |
| `--scale` | `stringArray` | | Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present. |
| `-y`, `--y` | `bool` | | Assume "yes" as answer to all prompts and run non-interactively |
| `-y`, `--yes` | `bool` | | Assume "yes" as answer to all prompts and run non-interactively |


<!---MARKER_GEN_END-->
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compose_up.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ If the process is interrupted using `SIGINT` (ctrl + C) or `SIGTERM`, the contai
| `--wait` | `bool` | | Wait for services to be running\|healthy. Implies detached mode. |
| `--wait-timeout` | `int` | `0` | Maximum duration in seconds to wait for the project to be running\|healthy |
| `-w`, `--watch` | `bool` | | Watch source code and rebuild/refresh containers when files are updated. |
| `-y`, `--y` | `bool` | | Assume "yes" as answer to all prompts and run non-interactively |
| `-y`, `--yes` | `bool` | | Assume "yes" as answer to all prompts and run non-interactively |


<!---MARKER_GEN_END-->
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/docker_compose_alpha_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: "y"
- option: "yes"
shorthand: "y"
value_type: bool
default_value: "false"
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/docker_compose_create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: "y"
- option: "yes"
shorthand: "y"
value_type: bool
default_value: "false"
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/docker_compose_up.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: "y"
- option: "yes"
shorthand: "y"
value_type: bool
default_value: "false"
Expand Down