28 lines
462 B
Go
28 lines
462 B
Go
package internal
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"exporter/config"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func LoginCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "login",
|
|
Short: "login account",
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
log.Println("init client")
|
|
defer log.Println("init client done")
|
|
return InitClient(config.C)
|
|
},
|
|
RunE: wrapE(func(ctx context.Context) error {
|
|
return client.Login(ctx)
|
|
}),
|
|
}
|
|
|
|
return cmd
|
|
}
|