From 36f3620b3d5418a9a0560a728102712e29a1bc4e Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Fri, 29 Sep 2023 22:22:41 +0100 Subject: Bail out if not in a dolt repository --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 23e360d..81fe85f 100644 --- a/main.go +++ b/main.go @@ -232,10 +232,12 @@ func CreateTable(table string) error { func ReadTableNames() []string { // Run dolt ls, ignore the first line and strip spaces for each following line cmd := exec.Command("dolt", "ls") - cmd.Stderr = os.Stderr + cmd.Stderr = nil out, err := cmd.Output() if err != nil { - return []string{} + fmt.Println("Error reading table names:", err) + fmt.Println("It seems like you are not in a dolt repository.") + os.Exit(1) } lines := strings.Split(string(out), "\n") tables := []string{} -- cgit v1.2.3-70-g09d2