Skip to content

Commit de3b30f

Browse files
committed
remove startMenu fn
Signed-off-by: Joana Hrotko <[email protected]>
1 parent 3436537 commit de3b30f

File tree

1 file changed

+16
-28
lines changed

1 file changed

+16
-28
lines changed

pkg/compose/up.go

+16-28
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,22 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
9090
first = false
9191
}
9292

93-
kEvents := s.startMenu(ctx, project, options, signalChan)
93+
var kEvents <-chan keyboard.KeyEvent
94+
if options.Start.NavigationMenu {
95+
kEvents, err = keyboard.GetKeys(100)
96+
if err != nil {
97+
logrus.Warn("Could not start Menu - an error occurred while starting.")
98+
} else {
99+
isWatchConfigured := s.shouldWatch(project)
100+
isDockerDesktopActive := s.isDesktopIntegrationActive()
101+
tracing.KeyboardMetrics(ctx, options.Start.NavigationMenu, isDockerDesktopActive, isWatchConfigured)
102+
103+
formatter.NewKeyboardManager(ctx, isDockerDesktopActive, isWatchConfigured, signalChan, s.Watch)
104+
if options.Start.Watch {
105+
formatter.KeyboardManager.StartWatch(ctx, project, options)
106+
}
107+
}
108+
}
94109
for {
95110
select {
96111
case <-doneCh:
@@ -165,30 +180,3 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
165180
}
166181
return err
167182
}
168-
169-
func (s *composeService) startMenu(
170-
ctx context.Context,
171-
project *types.Project,
172-
options api.UpOptions,
173-
sc chan<- os.Signal,
174-
) <-chan keyboard.KeyEvent {
175-
if !options.Start.NavigationMenu {
176-
return nil
177-
}
178-
kEvents, err := keyboard.GetKeys(100)
179-
keyboardInitiated := err == nil
180-
if !keyboardInitiated {
181-
logrus.Warn("Could not start Menu - an error occurred while starting.")
182-
return nil
183-
}
184-
185-
isWatchConfigured := s.shouldWatch(project)
186-
isDockerDesktopActive := s.isDesktopIntegrationActive()
187-
tracing.KeyboardMetrics(ctx, options.Start.NavigationMenu, isDockerDesktopActive, isWatchConfigured)
188-
189-
formatter.NewKeyboardManager(ctx, isDockerDesktopActive, isWatchConfigured, sc, s.Watch)
190-
if options.Start.Watch {
191-
formatter.KeyboardManager.StartWatch(ctx, project, options)
192-
}
193-
return kEvents
194-
}

0 commit comments

Comments
 (0)