-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinfo.go
More file actions
44 lines (35 loc) · 980 Bytes
/
info.go
File metadata and controls
44 lines (35 loc) · 980 Bytes
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
35
36
37
38
39
40
41
42
43
44
package info
import (
"fmt"
"log"
"os"
"github.com/provideplatform/provide-cli/cmd/common"
"github.com/spf13/cobra"
)
const contractTypeRegistry = "registry"
var contract map[string]interface{}
var contracts []interface{}
var contractType string
// InfoCmd is the handler for the `info` command
var InfoCmd = &cobra.Command{
Use: "info",
Short: "Get information about the currently authorized user",
Long: "Get information about the currently authorized user",
Run: showInfo,
}
func showInfo(cmd *cobra.Command, args []string) {
// User ID, email, username, ..
user, err := common.GetUserDetails()
if err != nil {
log.Printf("Unable to get user details: %s", err)
os.Exit(1)
}
if user != nil {
fmt.Println("Current User:")
fmt.Println(" ID: ", user.ID)
fmt.Println(" Name: ", user.Name)
fmt.Println(" First Name: ", user.FirstName)
fmt.Println(" Last Name: ", user.LastName)
fmt.Println(" Email: ", user.Email)
}
}