Skip to content

Commit

Permalink
Tidy up output
Browse files Browse the repository at this point in the history
  • Loading branch information
liamg committed Sep 26, 2020
1 parent de731f7 commit 04b62dd
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions cmd/gitjacker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,36 @@ Output Dir: %s

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

var branchStr string
for _, branch := range summary.Config.Branches {
branchStr = fmt.Sprintf("%s\n - %s (%s)", branchStr, branch.Name, branch.Remote)
branchStr = tml.Sprintf("%s\n - %s (%s)", branchStr, branch.Name, branch.Remote)
}
if len(summary.Config.Branches) == 0 {
branchStr = "n/a"
}

var userStr string
if summary.Config.User.Name != "" {
userStr = tml.Sprintf("%s\n - Name: %s", userStr, summary.Config.User.Name)
}
if summary.Config.User.Username != "" {
userStr = tml.Sprintf("%s\n - Username: <bold>%s", userStr, summary.Config.User.Username)
}
if summary.Config.User.Email != "" {
userStr = tml.Sprintf("%s\n - Email: <bold>%s", userStr, summary.Config.User.Email)
}
if summary.Config.GithubToken.Token != "" {
userStr = tml.Sprintf("%s\n - GitHub Token: %s:<bold>%s", userStr, summary.Config.GithubToken.Username, summary.Config.GithubToken.Token)
}

if userStr == "" {
userStr = "n/a"
}

_ = tml.Printf(`
Expand All @@ -130,8 +154,9 @@ Pack Data Listed: %t
Repository: %s
Remotes: %s
Branches: %s
User Info: %s
You can find the retrieved repository data in <blue>%s</blue>
You can find the retrieved repository data in <blue><bold>%s</bold></blue>
`,
status,
Expand All @@ -141,6 +166,7 @@ You can find the retrieved repository data in <blue>%s</blue>
summary.Config.RepositoryName,
remoteStr,
branchStr,
userStr,
summary.OutputDirectory,
)
},
Expand Down

0 comments on commit 04b62dd

Please sign in to comment.