Open penberg opened 1 year ago
Could you say more about what you perceive to be the problem here? This is actually fewer lines of output than the output of db create
itself.
The problem is that it's printing a lot of information I have no use for. When I create a database, I need two things: the URL and an authentication token. That's it.
OK, so it sounds like you're proposing two things. The first is the message that introduces the command (it should just say "to get a connection URL"), and also the command to get just the URL. Right now the message says "To see information about the database, including a connection URL", which is exactly what the command does now.
If you really want to speed this up, why not just print the URL in the db create
output instead of making them run a command? I think the original point of the message was to introduce the developer to the show command, which is important in its own right.
We could print the URL, but it becomes asymmetric with generating the token. I suppose that's fine. But what we want to optimize for here is time to running application. For example, in TypeScript/JavaScript apps, you usually have a .env.example
file with ready TURSO_DB_URL
and TURSO_DB_TOKEN
place-holder environment variables. That's the information we want to show to people quickly.
There's a balance here between being fast and being generally helpful. I'll point out that the use case you're optimizing for isn't helped by db shell
in the output. However, it's important for developers to know that invoking the shell is an important potential next step in discovering the product. I'd argue that the same is true about db show
. I think general helpfulness was the original use case for the current output, and I'd like to think carefully before changing that.
@CodingDoug suggested the following change to turso db create
:
Created database my-db in [Your Location] in [xx] seconds.
You can start an interactive SQL shell with:
turso db shell my-db
To see information about the database, run:
turso db show my-db
To bootstrap your app code with a connection url and access token, run these two commands:
turso db show my-db --url
turso db tokens create my-db
I think we can go even further (although @CodingDoug didn't seem to like it):
Created database my-db in [Your Location] in [xx] seconds.
You can start an interactive SQL shell with:
turso db shell my-db
To see information about the database, run:
turso db show my-db
To bootstrap your app code with a connection URL and access token, run these two commands:
export LIBSQL_CLIENT_URL=$(turso db show my-db --url)
export LIBSQL_CLIENT_TOKEN=$(turso db tokens create my-db)
And then use the LIBSQL_CLIENT_URL and LIBSQL_CLIENT_TOKEN environment variables in your app.
The
turso db create
command suggests runningturso db show
, but it's extremely verbose:Let's, for example, switch to recommeding people to run
turso db show --url