Skip to content

Commit

Permalink
Better console output
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed Apr 20, 2020
1 parent ffdb0ce commit 722d3b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mob.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"time"
)

const release = "0.0.5"
const release = "0.0.6"

var wipBranch = "mob-session" // override with MOB_WIP_BRANCH environment variable
var baseBranch = "master" // override with MOB_BASE_BRANCH environment variable
Expand Down Expand Up @@ -280,8 +280,7 @@ func status() {
if isMobProgramming() {
sayInfo("mob programming in progress")

output := silentgit("--no-pager", "log", baseBranch+".."+wipBranch, "--pretty=format:%h %cr <%an>", "--abbrev-commit")
say(output)
say(silentgit("--no-pager", "log", baseBranch+".."+wipBranch, "--pretty=format:%h %cr <%an>", "--abbrev-commit"))
} else {
sayInfo("you aren't mob programming right now")
}
Expand Down Expand Up @@ -381,8 +380,9 @@ func silentgit(args ...string) string {
fmt.Println(output)
}
if err != nil {
fmt.Println(output)
fmt.Println(err)
sayError("[" + strings.Join(command.Args, " ") + "]")
sayError(output)
sayError(err.Error())
os.Exit(1)
}
return output
Expand Down Expand Up @@ -423,11 +423,11 @@ func git(args ...string) string {
}

func say(s string) {
fmt.Println(strings.TrimSpace(s))
fmt.Println(strings.TrimRight(s, " \r\n\t\v\f\r"))
}

func sayError(s string) {
lines := strings.Split(s, "\n")
lines := strings.Split(strings.TrimSpace(s), "\n")
for i := 0; i < len(lines); i++ {
fmt.Print(" ERROR ")
fmt.Print(lines[i])
Expand Down

0 comments on commit 722d3b7

Please sign in to comment.