6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-07 19:54:19 +00:00

Add a list flag and basic rendering of repos status

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-03 15:59:51 +02:00
parent b7bd30c960
commit 64dfea5a7f
5 changed files with 108 additions and 41 deletions

View File

@@ -16,6 +16,9 @@ import (
const (
StatusUnknown = "unknown"
StatusDetached = "detached HEAD"
StatusNoUpstream = "no upstream"
StatusAhead = "ahead"
StatusBehind = "behind"
StatusOk = "ok"
StatusUncommitted = "uncommitted"
StatusUntracked = "untracked"
@@ -24,7 +27,7 @@ const (
type RepoStatus struct {
HasUntrackedFiles bool
HasUncommittedChanges bool
Current string
CurrentBranch string
Branches []*BranchStatus
}
@@ -63,7 +66,7 @@ func (r *Repo) LoadStatus() error {
r.Status.HasUncommittedChanges = hasUncommitted(status)
r.Status.HasUntrackedFiles = hasUntracked(status)
r.Status.Current = currentBranch(r)
r.Status.CurrentBranch = currentBranch(r)
err = r.loadBranchesStatus()
if err != nil {