From d6b84a0e738c89c4d699754cd03db3bc6dbfb900 Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Thu, 28 Sep 2023 02:13:49 +0100 Subject: Simplify menu for continuous usage --- main.go | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/main.go b/main.go index 2bf000e..1a5a72b 100644 --- a/main.go +++ b/main.go @@ -63,12 +63,6 @@ Running debby with any other arguments will run it as a dolt command.` RunSQL(query, "") case 2: if table == "" { - // List tables sequentially - fmt.Print("Available tables: ") - for _, t := range tables { - fmt.Printf(" [ %s ]", t) - } - fmt.Println() // Request table name fmt.Print("Enter your table name: ") fmt.Scanln(&table) @@ -96,20 +90,20 @@ Running debby with any other arguments will run it as a dolt command.` if noninteractive { return } - - // End of display - fmt.Print("Press enter to continue...") - fmt.Scanln() - // Clear screen - fmt.Print("\033[H\033[2J") - // Reset choice choice = 0 // Print menu - fmt.Println("1. Run query") - fmt.Println("2. Edit table") - fmt.Println("3. Execute Dolt command") - fmt.Println("4. Exit") - fmt.Print("Enter your choice: ") + + // List tables sequentially + fmt.Print("Tables: ") + for _, t := range tables { + fmt.Printf(" %s -", t) + } + fmt.Println() + fmt.Print("1. Run query ") + fmt.Print("2. Edit table ") + fmt.Print("3. Execute Dolt command ") + fmt.Print("4. Exit ") + fmt.Print("- Enter your choice: ") // Read user input fmt.Scanln(&choice) -- cgit v1.2.3-70-g09d2