Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: return a user friendly message if the user is not authenticated #155

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

fatih
Copy link
Member

@fatih fatih commented Apr 9, 2021

This PR adds a pre-hook to relevant subcommands that checks if the user is authenticated already. If not, it returns a user-friendly error message and tells them to authenticate via pscale auth login.

Before:

$ pscale db list
Error: required flag(s) "org" not set

After:

$ pscale db list
Error: not authenticated yet. Please run 'pscale auth login'

We didn't add the pre-hook to rootCmd, because that would block the user from executing the pscale auth commands.

closes https://github.com/planetscale/project-big-bang/issues/205

@fatih fatih requested a review from a team as a code owner April 9, 2021 09:26
This PR adds a pre-hook to relevant subcommands that checks if the user
is authenticated already. If not, it returns a user friendly error
message and tells them to authenticate via `pscale auth login`.

Before:

```
$ pscale db list
Error: required flag(s) "org" not set
```

After:

```
$ pscale db list
Error: not authenticated yet. Please run 'pscale auth login'
```

We didn't add the pre-hook to `rootCmd`, because that would block the
user executing the `pscale auth` commands.

closes planetscale/surfaces#205
@fatih fatih force-pushed the fatih/show-user-friendly-auth-message branch from 91ffa41 to 744cc84 Compare April 9, 2021 14:33
@fatih fatih enabled auto-merge April 9, 2021 14:34
@fatih fatih merged commit 5a7caea into main Apr 9, 2021
@fatih fatih deleted the fatih/show-user-friendly-auth-message branch April 9, 2021 14:34
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.

2 participants