-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.go
34 lines (30 loc) · 794 Bytes
/
login.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Package veribi implements command line commands that are user inside Veribi CLI.
package veribi
import (
"fmt"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/vaclav-dvorak/veribi-cli/pkg/veribi"
)
var loginCmd = &cobra.Command{
Use: "login",
Aliases: []string{"l"},
Short: "Login into Veribi platform",
Run: func(cmd *cobra.Command, args []string) {
if !silent {
printLogo()
}
log.Info("cmd login")
if viper.GetString("email") == "" || viper.GetString("pass") == "" {
log.Fatal("email or password is empty, run veribi init")
}
if err := veribi.Login(); err != nil {
log.Fatal(err)
}
fmt.Println("🎉 Congratulations you've been logged in. 🎉")
},
}
func init() {
rootCmd.AddCommand(loginCmd)
}