feat: improved output even more
This commit is contained in:
parent
1b1efcd3c1
commit
47d07c5177
3 changed files with 21 additions and 7 deletions
|
|
@ -149,8 +149,12 @@ func pullRepository(repoName string, repoDestination string) {
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(string(pullOutput), "You have unstaged changes"):
|
case strings.Contains(string(pullOutput), "You have unstaged changes"):
|
||||||
pullErrorMsg = append(pullErrorMsg, repoDestination)
|
pullErrorMsgUnstaged = append(pullErrorMsgUnstaged, repoDestination)
|
||||||
logger.Print("Found unstaged changes for repository: "+repoName+" at "+repoDestination, nil)
|
logger.Print("Found unstaged changes in repository: "+repoName+" at "+repoDestination, nil)
|
||||||
|
|
||||||
|
case strings.Contains(string(pullOutput), "Your index contains uncommitted changes"):
|
||||||
|
pullErrorMsgUncommitted = append(pullErrorMsgUncommitted, repoDestination)
|
||||||
|
logger.Print("Found uncommitted changes in repository: "+repoName+" at "+repoDestination, nil)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Print("ERROR: pulling "+repoName, nil)
|
logger.Print("ERROR: pulling "+repoName, nil)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ var gitBackend string
|
||||||
var clonedCount int
|
var clonedCount int
|
||||||
var errorCount int
|
var errorCount int
|
||||||
var pulledCount int
|
var pulledCount int
|
||||||
var pullErrorMsg []string
|
var pullErrorMsgUnstaged []string
|
||||||
|
var pullErrorMsgUncommitted []string
|
||||||
|
|
||||||
// repository data
|
// repository data
|
||||||
type Repository struct {
|
type Repository struct {
|
||||||
|
|
@ -76,5 +77,6 @@ func main() {
|
||||||
// manage found repositories
|
// manage found repositories
|
||||||
checkoutRepositories(repositories, concurrency)
|
checkoutRepositories(repositories, concurrency)
|
||||||
printSummary()
|
printSummary()
|
||||||
printPullError(pullErrorMsg)
|
printPullErrorUnstaged(pullErrorMsgUnstaged)
|
||||||
|
printPullErrorUncommitted(pullErrorMsgUncommitted)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,18 @@ func printSummary() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func printPullError(pullErrorMsg []string) {
|
func printPullErrorUnstaged(pullErrorMsgUnstaged []string) {
|
||||||
if len(pullErrorMsg) > 0 {
|
if len(pullErrorMsgUnstaged) > 0 {
|
||||||
for _, repo := range pullErrorMsg {
|
for _, repo := range pullErrorMsgUnstaged {
|
||||||
fmt.Printf("❕%s has unstaged changes.\n", repo)
|
fmt.Printf("❕%s has unstaged changes.\n", repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printPullErrorUncommitted(pullErrorMsgUncommitted []string) {
|
||||||
|
if len(pullErrorMsgUncommitted) > 0 {
|
||||||
|
for _, repo := range pullErrorMsgUncommitted {
|
||||||
|
fmt.Printf("❕%s has uncommitted changes.\n", repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue