Files
tg_exporter/internal/cmd_login.go
2024-09-04 17:37:43 +08:00

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
}