Skip to content

fix(db): suggest database name for hostname prefix#1039

Open
ada-powerful wants to merge 1 commit into
tursodatabase:mainfrom
ada-powerful:suggest-db-name-for-host-prefix
Open

fix(db): suggest database name for hostname prefix#1039
ada-powerful wants to merge 1 commit into
tursodatabase:mainfrom
ada-powerful:suggest-db-name-for-host-prefix

Conversation

@ada-powerful
Copy link
Copy Markdown

Fixes #606.

Problem

A database named hello can have a hostname like hello-penberg.turso.io. Users may reasonably try:

turso db shell hello-penberg

and currently get only:

database hello-penberg not found. List known databases using turso db list

Fix

When a database lookup by name fails, check whether the requested value matches the hostname prefix of a known database. If so, keep the command semantics unchanged but include a direct suggestion, e.g. Did you mean hello?.

I chose the suggestion path rather than an implicit alias so other commands do not silently operate on a different database name than the user typed.

Tests

docker run --rm -v "$PWD":/src -w /src golang:1.25 gofmt -w internal/cmd/db.go internal/cmd/db_test.go
docker run --rm -v "$PWD":/src -w /src golang:1.25 go test ./internal/cmd -run "TestSuggestDatabaseName"
docker run --rm -v "$PWD":/src -w /src golang:1.25 go test ./internal/cmd

Disclosure

This PR was prepared by an AI agent under direct human review. Happy to adjust the wording or alias behavior if maintainers prefer the other option from the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

turso db shell woes because of mismatch between database name and URL

1 participant