@@ -33,7 +33,6 @@ import (
3333
3434 "github.com/docker/compose/v2/cmd/formatter"
3535 "github.com/docker/compose/v2/pkg/api"
36- ui "github.com/docker/compose/v2/pkg/progress"
3736 "github.com/docker/compose/v2/pkg/utils"
3837)
3938
@@ -44,23 +43,21 @@ type composeOptions struct {
4443
4544type upOptions struct {
4645 * composeOptions
47- Detach bool
48- noStart bool
49- noDeps bool
50- cascadeStop bool
51- cascadeFail bool
52- exitCodeFrom string
53- noColor bool
54- noPrefix bool
55- attachDependencies bool
56- attach []string
57- noAttach []string
58- timestamp bool
59- wait bool
60- waitTimeout int
61- watch bool
62- navigationMenu bool
63- navigationMenuChanged bool
46+ Detach bool
47+ noStart bool
48+ noDeps bool
49+ cascadeStop bool
50+ cascadeFail bool
51+ exitCodeFrom string
52+ noColor bool
53+ noPrefix bool
54+ attachDependencies bool
55+ attach []string
56+ noAttach []string
57+ timestamp bool
58+ wait bool
59+ waitTimeout int
60+ watch bool
6461}
6562
6663func (opts upOptions ) apply (project * types.Project , services []string ) (* types.Project , error ) {
@@ -82,22 +79,6 @@ func (opts upOptions) apply(project *types.Project, services []string) (*types.P
8279 return project , nil
8380}
8481
85- func (opts * upOptions ) validateNavigationMenu (dockerCli command.Cli ) {
86- if ! dockerCli .Out ().IsTerminal () {
87- opts .navigationMenu = false
88- return
89- }
90- // If --menu flag was not set
91- if ! opts .navigationMenuChanged {
92- if envVar , ok := os .LookupEnv (ComposeMenu ); ok {
93- opts .navigationMenu = utils .StringToBool (envVar )
94- return
95- }
96- // ...and COMPOSE_MENU env var is not defined we want the default value to be true
97- opts .navigationMenu = true
98- }
99- }
100-
10182func (opts upOptions ) OnExit () api.Cascade {
10283 switch {
10384 case opts .cascadeStop :
@@ -119,7 +100,6 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c
119100 PreRunE : AdaptCmd (func (ctx context.Context , cmd * cobra.Command , args []string ) error {
120101 create .pullChanged = cmd .Flags ().Changed ("pull" )
121102 create .timeChanged = cmd .Flags ().Changed ("timeout" )
122- up .navigationMenuChanged = cmd .Flags ().Changed ("menu" )
123103 if ! cmd .Flags ().Changed ("remove-orphans" ) {
124104 create .removeOrphans = utils .StringToBool (os .Getenv (ComposeRemoveOrphans ))
125105 }
@@ -134,8 +114,6 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c
134114 return errors .New ("cannot combine --attach and --attach-dependencies" )
135115 }
136116
137- up .validateNavigationMenu (dockerCli )
138-
139117 if ! p .All && len (project .Services ) == 0 {
140118 return fmt .Errorf ("no service selected" )
141119 }
@@ -171,7 +149,6 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c
171149 flags .BoolVar (& up .wait , "wait" , false , "Wait for services to be running|healthy. Implies detached mode." )
172150 flags .IntVar (& up .waitTimeout , "wait-timeout" , 0 , "Maximum duration in seconds to wait for the project to be running|healthy" )
173151 flags .BoolVarP (& up .watch , "watch" , "w" , false , "Watch source code and rebuild/refresh containers when files are updated." )
174- 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." )
175152 flags .BoolVarP (& create .AssumeYes , "yes" , "y" , false , `Assume "yes" as answer to all prompts and run non-interactively` )
176153 flags .SetNormalizeFunc (func (f * pflag.FlagSet , name string ) pflag.NormalizedName {
177154 // assumeYes was introduced by mistake as `--y`
@@ -181,6 +158,10 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *c
181158 }
182159 return pflag .NormalizedName (name )
183160 })
161+
162+ flags .Bool ("menu" , false , "DISABLED" )
163+ _ = flags .MarkHidden ("menu" )
164+
184165 return upCmd
185166}
186167
@@ -223,7 +204,6 @@ func validateFlags(up *upOptions, create *createOptions) error {
223204 return nil
224205}
225206
226- //nolint:gocyclo
227207func runUp (
228208 ctx context.Context ,
229209 dockerCli command.Cli ,
@@ -322,16 +302,15 @@ func runUp(
322302 return backend .Up (ctx , project , api.UpOptions {
323303 Create : create ,
324304 Start : api.StartOptions {
325- Project : project ,
326- Attach : consumer ,
327- AttachTo : attach ,
328- ExitCodeFrom : upOptions .exitCodeFrom ,
329- OnExit : upOptions .OnExit (),
330- Wait : upOptions .wait ,
331- WaitTimeout : timeout ,
332- Watch : upOptions .watch ,
333- Services : services ,
334- NavigationMenu : upOptions .navigationMenu && ui .Mode != "plain" && dockerCli .In ().IsTerminal (),
305+ Project : project ,
306+ Attach : consumer ,
307+ AttachTo : attach ,
308+ ExitCodeFrom : upOptions .exitCodeFrom ,
309+ OnExit : upOptions .OnExit (),
310+ Wait : upOptions .wait ,
311+ WaitTimeout : timeout ,
312+ Watch : upOptions .watch ,
313+ Services : services ,
335314 },
336315 })
337316}
0 commit comments