Skip to content

Commit

Permalink
fix: handle empty credentials when listing credentials (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianfeng92 authored Jun 20, 2023
1 parent b23ddbc commit 53e9939
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/cmd/configure/list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package configure

import (
"fmt"

"github.com/saucelabs/saucectl/internal/credentials"
"github.com/spf13/cobra"
)
Expand All @@ -14,6 +16,10 @@ func ListCommand() *cobra.Command {
Short: "Shows the current credentials and their origin.",
Run: func(cmd *cobra.Command, args []string) {
creds := credentials.Get()
if creds.Username == "" || creds.AccessKey == "" {
fmt.Println(`Credentials have not been set. Please use "saucectl configure" to set your credentials.`)
return
}
printCreds(creds)
},
}
Expand Down

0 comments on commit 53e9939

Please sign in to comment.