aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2023-09-29 22:22:41 +0100
committerJoop Kiefte <ikojba@gmail.com>2023-09-29 22:22:41 +0100
commit36f3620b3d5418a9a0560a728102712e29a1bc4e (patch)
tree4c880d3f391498c72abe075632c8a173079c6f85
parente2d9b8acde4aa61d4294d945ab02a6a23af68fc5 (diff)
Bail out if not in a dolt repository
-rw-r--r--main.go6
1 files 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{}