github.com/saucelabs/saucectl@v0.175.1/internal/cmd/configure/list.go (about)

     1  package configure
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/saucelabs/saucectl/internal/credentials"
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  func ListCommand() *cobra.Command {
    11  	cmd := &cobra.Command{
    12  		Use: "list",
    13  		Aliases: []string{
    14  			"ls",
    15  		},
    16  		Short: "Shows the current credentials and their origin.",
    17  		Run: func(cmd *cobra.Command, args []string) {
    18  			creds := credentials.Get()
    19  			if creds.Username == "" || creds.AccessKey == "" {
    20  				fmt.Println(`Credentials have not been set. Please use "saucectl configure" to set your credentials.`)
    21  				return
    22  			}
    23  			printCreds(creds)
    24  		},
    25  	}
    26  
    27  	return cmd
    28  }