-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_show.go
36 lines (32 loc) · 898 Bytes
/
cmd_show.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
35
36
package main
import (
"fmt"
"github.com/urfave/cli"
)
func cmdShow(c *cli.Context) {
if !isGitRepositoryDir() {
fmt.Println("Your current directory is not a git repository.")
return
}
globalName := getGlobalName()
globalEmail := getGlobalEmail()
name := getName()
email := getEmail()
hasLocalGitUserSetting := true
if name == "" && email == "" {
fmt.Println("Your Git's local user name and email are not set.")
hasLocalGitUserSetting = false
} else if name == "" {
fmt.Println("Your Git's local user name is not set.")
hasLocalGitUserSetting = false
} else if email == "" {
fmt.Println("Your Git's local email is not set.")
hasLocalGitUserSetting = false
}
if !hasLocalGitUserSetting {
fmt.Println("Currently the following Git's global user are in use.")
fmt.Println(globalName + " <" + globalEmail + ">")
return
}
fmt.Println(name + " <" + email + ">")
}