From 37b00556e7a64ff0b36fa084993b4f86676232f6 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Sat, 19 Oct 2024 10:35:34 +0300 Subject: [PATCH] Move code that was just for printing the Menu to different private function --- simple/menu.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/simple/menu.go b/simple/menu.go index 0854f29..a48c879 100644 --- a/simple/menu.go +++ b/simple/menu.go @@ -208,8 +208,7 @@ func (m *Menu) handleInput(input string) { } } -func (m *Menu) iteration() { - m.Log.Flush() +func (m *Menu) printMenu() { fmt.Printf("%s\n", m.Title) m.lineCounter++ path := "" @@ -235,6 +234,11 @@ func (m *Menu) iteration() { fmt.Printf("%s: Go back one layer\n", m.BackKey) m.lineCounter++ } +} + +func (m *Menu) iteration() { + m.Log.Flush() + m.printMenu() stdinReader := bufio.NewReader(os.Stdin) msg, err := stdinReader.ReadString('\n') if err != nil {