Skip to content

Commit 05fecc5

Browse files
committed
Allow turso config set token without being logged in
Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
1 parent 6ec7005 commit 05fecc5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

internal/cmd/root.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ func Execute() {
2929

3030
var noMultipleTokenSourcesWarning bool
3131

32+
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+
}
35+
3236
func init() {
3337
rootCmd.PersistentFlags().StringP("config-path", "c", "", "Path to the directory with config file")
3438
if err := viper.BindPFlag("config-path", rootCmd.PersistentFlags().Lookup("config-path")); err != nil {
@@ -83,7 +87,7 @@ func init() {
8387
}
8488
}
8589
rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
86-
if cmd.Name() == "login" || cmd.Name() == "signup" {
90+
if !requiresLogin(cmd) {
8791
return
8892
}
8993
_, err := getAccessToken()

0 commit comments

Comments
 (0)