diff options
-rw-r--r-- | main.go | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -16,8 +16,10 @@ func main() { var table string var query string var args []string + var noninteractive bool if len(os.Args) > 1 { + noninteractive = true switch os.Args[1] { case "ls": // List tables choice = 1 @@ -85,21 +87,26 @@ Running debby with any other arguments will run it as a dolt command.` case 5: // Exit return - default: - // Reset choice - choice = 0 - // Print menu - fmt.Println("1. Read table names") - fmt.Println("2. Run query") - fmt.Println("3. Edit table") - fmt.Println("4. Execute Dolt command") - fmt.Println("5. Exit") - fmt.Print("Enter your choice: ") + } - // Read user input - fmt.Scanln(&choice) + // If noninteractive, exit + if noninteractive { + return } + // Reset choice + choice = 0 + // Print menu + fmt.Println("1. Read table names") + fmt.Println("2. Run query") + fmt.Println("3. Edit table") + fmt.Println("4. Execute Dolt command") + fmt.Println("5. Exit") + fmt.Print("Enter your choice: ") + + // Read user input + fmt.Scanln(&choice) + // Reset all variables except choice table = "" query = "" |