Skip to content

Commit e1d76ca

Browse files
committed
Add turso completion to allowlist for login requirement
Fixes tursodatabase/homebrew-tap#3 Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
1 parent 86e2049 commit e1d76ca

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

internal/cmd/root.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"os"
7+
"strings"
78
"time"
89

910
semver "github.com/hashicorp/go-version"
@@ -30,7 +31,20 @@ func Execute() {
3031
var noMultipleTokenSourcesWarning bool
3132

3233
func requiresLogin(cmd *cobra.Command) bool {
33-
return cmd.Name() != "login" && cmd.Name() != "signup" && cmd.CommandPath() != "turso config set token" && cmd.CommandPath() != "turso update"
34+
path := cmd.CommandPath()
35+
allowlist := []string{
36+
"turso auth login",
37+
"turso auth signup",
38+
"turso config set token",
39+
"turso update",
40+
"turso completion",
41+
}
42+
for _, allowed := range allowlist {
43+
if strings.HasPrefix(path, allowed) {
44+
return false
45+
}
46+
}
47+
return true
3448
}
3549

3650
func init() {

0 commit comments

Comments
 (0)