Skip to content

Commit 04b62dd

Browse files
committed
Tidy up output
1 parent de731f7 commit 04b62dd

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

cmd/gitjacker/main.go

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,36 @@ Output Dir: %s
114114

115115
var remoteStr string
116116
for _, remote := range summary.Config.Remotes {
117-
remoteStr = fmt.Sprintf("%s\n - %s: %s", remoteStr, remote.Name, remote.URL)
117+
remoteStr = tml.Sprintf("%s\n - %s: <bold>%s", remoteStr, remote.Name, remote.URL)
118+
}
119+
if len(summary.Config.Remotes) == 0 {
120+
remoteStr = "n/a"
118121
}
119122

120123
var branchStr string
121124
for _, branch := range summary.Config.Branches {
122-
branchStr = fmt.Sprintf("%s\n - %s (%s)", branchStr, branch.Name, branch.Remote)
125+
branchStr = tml.Sprintf("%s\n - %s (%s)", branchStr, branch.Name, branch.Remote)
126+
}
127+
if len(summary.Config.Branches) == 0 {
128+
branchStr = "n/a"
129+
}
130+
131+
var userStr string
132+
if summary.Config.User.Name != "" {
133+
userStr = tml.Sprintf("%s\n - Name: %s", userStr, summary.Config.User.Name)
134+
}
135+
if summary.Config.User.Username != "" {
136+
userStr = tml.Sprintf("%s\n - Username: <bold>%s", userStr, summary.Config.User.Username)
137+
}
138+
if summary.Config.User.Email != "" {
139+
userStr = tml.Sprintf("%s\n - Email: <bold>%s", userStr, summary.Config.User.Email)
140+
}
141+
if summary.Config.GithubToken.Token != "" {
142+
userStr = tml.Sprintf("%s\n - GitHub Token: %s:<bold>%s", userStr, summary.Config.GithubToken.Username, summary.Config.GithubToken.Token)
143+
}
144+
145+
if userStr == "" {
146+
userStr = "n/a"
123147
}
124148

125149
_ = tml.Printf(`
@@ -130,8 +154,9 @@ Pack Data Listed: %t
130154
Repository: %s
131155
Remotes: %s
132156
Branches: %s
157+
User Info: %s
133158
134-
You can find the retrieved repository data in <blue>%s</blue>
159+
You can find the retrieved repository data in <blue><bold>%s</bold></blue>
135160
136161
`,
137162
status,
@@ -141,6 +166,7 @@ You can find the retrieved repository data in <blue>%s</blue>
141166
summary.Config.RepositoryName,
142167
remoteStr,
143168
branchStr,
169+
userStr,
144170
summary.OutputDirectory,
145171
)
146172
},

0 commit comments

Comments
 (0)