File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ var shellCmd = &cobra.Command{
9797 // Makes sure localhost URL or self-hosted will work even if not authenticated
9898 // to turso. The token code will check for auth
9999 if ! isURL (nameOrUrl ) {
100+ VerifyUserIsLoggedIn ()
100101 client , err := authedTursoClient ()
101102 if err != nil {
102103 return fmt .Errorf ("could not create turso client: %w" , err )
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ func requiresLogin(cmd *cobra.Command) bool {
3838 "turso config set token" ,
3939 "turso update" ,
4040 "turso completion" ,
41+ "turso db shell" ,
4142 }
4243 for _ , allowed := range allowlist {
4344 if strings .HasPrefix (path , allowed ) {
@@ -104,13 +105,17 @@ func init() {
104105 if ! requiresLogin (cmd ) {
105106 return
106107 }
107- _ , err := getAccessToken ()
108- if errors .Is (err , ErrNotLoggedIn ) {
109- fmt .Printf ("You are not logged in, please login with %s before running other commands.\n " , internal .Emph ("turso auth login" ))
110- os .Exit (0 )
111- }
108+ VerifyUserIsLoggedIn ()
112109 }
113110 rootCmd .CompletionOptions .HiddenDefaultCmd = true
114111 flags .AddDebugFlag (rootCmd )
115112 flags .AddResetConfigFlag (rootCmd )
116113}
114+
115+ func VerifyUserIsLoggedIn () {
116+ _ , err := getAccessToken ()
117+ if errors .Is (err , ErrNotLoggedIn ) {
118+ fmt .Printf ("You are not logged in, please login with %s before running other commands.\n " , internal .Emph ("turso auth login" ))
119+ os .Exit (0 )
120+ }
121+ }
You can’t perform that action at this time.
0 commit comments