diff options
author | Joop Kiefte <ikojba@gmail.com> | 2023-09-29 22:22:41 +0100 |
---|---|---|
committer | Joop Kiefte <ikojba@gmail.com> | 2023-09-29 22:22:41 +0100 |
commit | 36f3620b3d5418a9a0560a728102712e29a1bc4e (patch) | |
tree | 4c880d3f391498c72abe075632c8a173079c6f85 | |
parent | e2d9b8acde4aa61d4294d945ab02a6a23af68fc5 (diff) |
Bail out if not in a dolt repository
-rw-r--r-- | main.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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{} |