Skip to content

Commit 4164984

Browse files
committed
declare --volume as an alias for --volumes
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent cb45c6f commit 4164984

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmd/compose/down.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import (
2222
"time"
2323

2424
"github.com/compose-spec/compose-go/types"
25+
"github.com/sirupsen/logrus"
2526
"github.com/spf13/cobra"
27+
"github.com/spf13/pflag"
2628

2729
"github.com/docker/compose/v2/pkg/api"
2830
)
@@ -62,6 +64,14 @@ func downCommand(p *projectOptions, backend api.Service) *cobra.Command {
6264
flags.IntVarP(&opts.timeout, "timeout", "t", 10, "Specify a shutdown timeout in seconds")
6365
flags.BoolVarP(&opts.volumes, "volumes", "v", false, " Remove named volumes declared in the `volumes` section of the Compose file and anonymous volumes attached to containers.")
6466
flags.StringVar(&opts.images, "rmi", "", `Remove images used by services. "local" remove only images that don't have a custom tag ("local"|"all")`)
67+
flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
68+
switch name {
69+
case "volume":
70+
name = "volumes"
71+
logrus.Warn("--volume is deprecated, please use --volumes")
72+
}
73+
return pflag.NormalizedName(name)
74+
})
6575
return downCmd
6676
}
6777

0 commit comments

Comments
 (0)