Skip to content

Commit 0cdc5c9

Browse files
ndeloofglours
authored andcommitted
rename --no-TTY => --no-tty for consistency
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent b768232 commit 0cdc5c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/compose/exec.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/docker/compose/v2/pkg/compose"
3030
"github.com/sirupsen/logrus"
3131
"github.com/spf13/cobra"
32+
"github.com/spf13/pflag"
3233
)
3334

3435
type execOpts struct {
@@ -81,7 +82,7 @@ func execCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service)
8182
runCmd.Flags().IntVar(&opts.index, "index", 0, "Index of the container if service has multiple replicas")
8283
runCmd.Flags().BoolVarP(&opts.privileged, "privileged", "", false, "Give extended privileges to the process")
8384
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.")
8586
runCmd.Flags().StringVarP(&opts.workingDir, "workdir", "w", "", "Path to workdir directory for this command")
8687

8788
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)
9091
runCmd.Flags().MarkHidden("tty") //nolint:errcheck
9192

9293
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+
})
93100
return runCmd
94101
}
95102

0 commit comments

Comments
 (0)