mirror of
https://github.com/docker/compose.git
synced 2025-07-26 23:24:05 +02:00
Merge pull request #1445 from gtardif/ansi_flag
This commit is contained in:
commit
40a24af897
@ -104,18 +104,26 @@ func (o *projectOptions) toProjectOptions(po ...cli.ProjectOptionsFn) (*cli.Proj
|
|||||||
func Command(contextType string) *cobra.Command {
|
func Command(contextType string) *cobra.Command {
|
||||||
opts := projectOptions{}
|
opts := projectOptions{}
|
||||||
var ansi string
|
var ansi string
|
||||||
|
var noAnsi bool
|
||||||
command := &cobra.Command{
|
command := &cobra.Command{
|
||||||
Short: "Docker Compose",
|
Short: "Docker Compose",
|
||||||
Use: "compose",
|
Use: "compose",
|
||||||
TraverseChildren: true,
|
TraverseChildren: true,
|
||||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
if noAnsi {
|
||||||
|
if ansi != "auto" {
|
||||||
|
return errors.New(`cannot specify DEPRECATED "--no-ansi" and "--ansi". Please use only "--ansi"`)
|
||||||
|
}
|
||||||
|
ansi = "never"
|
||||||
|
fmt.Fprint(os.Stderr, aec.Apply("option '--no-ansi' is DEPRECATED ! Please use '--ansi' instead.\n", aec.RedF))
|
||||||
|
}
|
||||||
formatter.SetANSIMode(ansi)
|
formatter.SetANSIMode(ansi)
|
||||||
if opts.WorkDir != "" {
|
if opts.WorkDir != "" {
|
||||||
if opts.ProjectDir != "" {
|
if opts.ProjectDir != "" {
|
||||||
return errors.New(aec.Apply(`cannot specify DEPRECATED "--workdir" and "--project-directory". Please use only "--project-directory" instead.`, aec.RedF))
|
return errors.New(`cannot specify DEPRECATED "--workdir" and "--project-directory". Please use only "--project-directory" instead`)
|
||||||
}
|
}
|
||||||
opts.ProjectDir = opts.WorkDir
|
opts.ProjectDir = opts.WorkDir
|
||||||
fmt.Fprint(os.Stderr, aec.Apply(`option "--workdir" is DEPRECATED at root level! Please use "--project-directory" instead.\n`, aec.RedF))
|
fmt.Fprint(os.Stderr, aec.Apply("option '--workdir' is DEPRECATED at root level! Please use '--project-directory' instead.\n", aec.RedF))
|
||||||
}
|
}
|
||||||
if contextType == store.DefaultContextType || contextType == store.LocalContextType {
|
if contextType == store.DefaultContextType || contextType == store.LocalContextType {
|
||||||
Warning = "The new 'docker compose' command is currently experimental. " +
|
Warning = "The new 'docker compose' command is currently experimental. " +
|
||||||
@ -157,5 +165,7 @@ func Command(contextType string) *cobra.Command {
|
|||||||
command.Flags().SetInterspersed(false)
|
command.Flags().SetInterspersed(false)
|
||||||
opts.addProjectFlags(command.Flags())
|
opts.addProjectFlags(command.Flags())
|
||||||
command.Flags().StringVar(&ansi, "ansi", "auto", `Control when to print ANSI control characters ("never"|"always"|"auto")`)
|
command.Flags().StringVar(&ansi, "ansi", "auto", `Control when to print ANSI control characters ("never"|"always"|"auto")`)
|
||||||
|
command.Flags().BoolVar(&noAnsi, "no-ansi", false, `Do not print ANSI control characters (DEPRECATED)`)
|
||||||
|
command.Flags().MarkHidden("no-ansi") //nolint:errcheck
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func pullCommand(p *projectOptions) *cobra.Command {
|
|||||||
Short: "Pull service images",
|
Short: "Pull service images",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if opts.noParallel {
|
if opts.noParallel {
|
||||||
fmt.Fprint(os.Stderr, aec.Apply(`option "--no-parallel" is DEPRECATED and will be ignored.\n`, aec.RedF))
|
fmt.Fprint(os.Stderr, aec.Apply("option '--no-parallel' is DEPRECATED and will be ignored.\n", aec.RedF))
|
||||||
}
|
}
|
||||||
return runPull(cmd.Context(), opts, args)
|
return runPull(cmd.Context(), opts, args)
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user