Fix first-time config gen, improve project_go
This commit is contained in:
@ -79,18 +79,25 @@ func (p *Project) GetGitInfo() string {
|
||||
}
|
||||
|
||||
var str string
|
||||
str += "\n" + pterm.LightRed("Project: ") + pterm.Bold.Sprint(p.Name) + "\n"
|
||||
|
||||
head, _ := repo.Head()
|
||||
branch := head.Name().String()[11:]
|
||||
b, _ := repo.Branch(branch)
|
||||
if b != nil {
|
||||
str = "\n" + pterm.LightCyan("Branch: ") + pterm.Bold.Sprint(b.Name) + "\n"
|
||||
str += pterm.LightCyan("Branch: ") + pterm.Bold.Sprint(b.Name) + "\n"
|
||||
} else {
|
||||
str = "\n" + pterm.LightCyan("NEW Branch: ") + pterm.Bold.Sprint(branch) + "\n"
|
||||
str += pterm.LightCyan("NEW Branch: ") + pterm.Bold.Sprint(branch) + "\n"
|
||||
}
|
||||
|
||||
commit, _ := repo.CommitObject(head.Hash())
|
||||
str += commit.String()
|
||||
str += "\n" + commit.String()
|
||||
|
||||
str += pterm.LightMagenta("GitLab: ") + pterm.Bold.Sprint(p.HTTPURLToRepo) + "\n"
|
||||
|
||||
if remotes, _ := repo.Remotes(); len(remotes) > 0 {
|
||||
str += pterm.LightBlue("Remote: ") + pterm.Bold.Sprint(remotes[0].Config().URLs[0])
|
||||
}
|
||||
|
||||
return pterm.DefaultBox.
|
||||
WithLeftPadding(5).WithRightPadding(5).
|
||||
|
Reference in New Issue
Block a user