@@ -29,6 +29,7 @@ import (
29
29
"github.com/docker/compose/v2/pkg/compose"
30
30
"github.com/sirupsen/logrus"
31
31
"github.com/spf13/cobra"
32
+ "github.com/spf13/pflag"
32
33
)
33
34
34
35
type execOpts struct {
@@ -81,7 +82,7 @@ func execCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service)
81
82
runCmd .Flags ().IntVar (& opts .index , "index" , 0 , "Index of the container if service has multiple replicas" )
82
83
runCmd .Flags ().BoolVarP (& opts .privileged , "privileged" , "" , false , "Give extended privileges to the process" )
83
84
runCmd .Flags ().StringVarP (& opts .user , "user" , "u" , "" , "Run the command as this user" )
84
- runCmd .Flags ().BoolVarP (& opts .noTty , "no-TTY " , "T" , ! dockerCli .Out ().IsTerminal (), "Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY." )
85
+ runCmd .Flags ().BoolVarP (& opts .noTty , "no-tty " , "T" , ! dockerCli .Out ().IsTerminal (), "Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY." )
85
86
runCmd .Flags ().StringVarP (& opts .workingDir , "workdir" , "w" , "" , "Path to workdir directory for this command" )
86
87
87
88
runCmd .Flags ().BoolVarP (& opts .interactive , "interactive" , "i" , true , "Keep STDIN open even if not attached" )
@@ -90,6 +91,12 @@ func execCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service)
90
91
runCmd .Flags ().MarkHidden ("tty" ) //nolint:errcheck
91
92
92
93
runCmd .Flags ().SetInterspersed (false )
94
+ runCmd .Flags ().SetNormalizeFunc (func (f * pflag.FlagSet , name string ) pflag.NormalizedName {
95
+ if name == "no-TTY" { // legacy
96
+ name = "no-tty"
97
+ }
98
+ return pflag .NormalizedName (name )
99
+ })
93
100
return runCmd
94
101
}
95
102
0 commit comments