tursodatabase / turso-cli

Command line interface to Turso.
https://turso.tech
MIT License
215 stars 35 forks source link

auth login suggestion for creating a db should only happen if they have no existing db #287

Closed CodingDoug closed 1 year ago

CodingDoug commented 1 year ago
✏️  We are so happy you are here! Now that you are authenticated, it is time to create a database:
    turso db create

This is great advice for first time users of the CLI, but possibly distressing for those who already have a database (they might be thinking: do I have to create another one one now?).

haaawk commented 1 year ago

But this is shown to the user only once? See:

https://github.com/chiselstrike/turso-cli/blob/main/internal/cmd/auth.go#L164-L167

Isn't that good enough @CodingDoug ?

CodingDoug commented 1 year ago

It was showed to me even though I had 5 databases, so it must only be a local flag right now. If that's the case, then when I use another machine, or reconfigure the same one, it will ask me again?

Edit: to be clear, I think it would be best to consult the API to figure out if the user has any databases, not a local cache.

haaawk commented 1 year ago

The notification will be displayed when you use different machine or remove config file. It is just a local variable that stores the info. But checking for existing dbs has the same drawback. If you create 5 databases and then destroy all of them then you will see the notification anyway if we safeguard it with the check for existing db.

CodingDoug commented 1 year ago

I'm fine with that, because creating a database is still the next logical step after signing in without any databases present (there is no other task to accomplish using the CLI without a database). Even if they chose to go from >0 to 0 later.