Skip to content

Commit 9c0c037

Browse files
committed
v0.0.3 with better error explaining
1 parent 2e9af5b commit 9c0c037

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

mob.go

+17-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"time"
1212
)
1313

14-
const release = "0.0.2"
14+
const release = "0.0.3"
1515

1616
var wipBranch = "mob-session" // override with MOB_WIP_BRANCH environment variable
1717
var baseBranch = "master" // override with MOB_BASE_BRANCH environment variable
@@ -123,7 +123,7 @@ func startTimer(timerInMinutes string) {
123123
err := command.Start()
124124
if err != nil {
125125
sayError("timer couldn't be started... (timer only works on OSX)")
126-
sayError(err)
126+
sayError(err.Error())
127127
} else {
128128
timeOfTimeout := time.Now().Add(time.Minute * time.Duration(timeoutInMinutes)).Format("15:04")
129129
sayOkay(timerInMinutes + " minutes timer started (finishes at approx. " + timeOfTimeout + ")")
@@ -205,7 +205,7 @@ func startZoomScreenshare() {
205205
err := command.Start()
206206
if err != nil {
207207
sayError("screenshare couldn't be started... (screenshare only works on OSX or Linux with xdotool installed)")
208-
sayError(err)
208+
sayError(err.Error())
209209
} else {
210210
if runtime.GOOS == "linux" {
211211
sayOkay("Sharing screen with zoom (requires the global shortcut ALT+S)")
@@ -411,11 +411,12 @@ func git(args ...string) string {
411411
fmt.Println(output)
412412
}
413413
if err != nil {
414-
sayError(command.Args)
415-
sayError(err)
414+
sayError("[" + strings.Join(command.Args, " ") + "]")
415+
sayError(output)
416+
sayError(err.Error())
416417
os.Exit(1)
417418
} else {
418-
sayOkay(command.Args)
419+
sayOkay("[" + strings.Join(command.Args, " ") + "]")
419420
}
420421
return output
421422
}
@@ -424,25 +425,28 @@ func say(s string) {
424425
fmt.Println(s)
425426
}
426427

427-
func sayError(s interface{}) {
428-
fmt.Print(" ⚡ ")
429-
fmt.Print(s)
430-
fmt.Print("\n")
428+
func sayError(s string) {
429+
lines := strings.Split(s, "\n")
430+
for i := 0; i < len(lines); i++ {
431+
fmt.Print(" ERROR ")
432+
fmt.Print(lines[i])
433+
fmt.Print("\n")
434+
}
431435
}
432436

433-
func sayOkay(s interface{}) {
437+
func sayOkay(s string) {
434438
fmt.Print(" ✓ ")
435439
fmt.Print(s)
436440
fmt.Print("\n")
437441
}
438442

439-
func sayNote(s interface{}) {
443+
func sayNote(s string) {
440444
fmt.Print(" ❗ ")
441445
fmt.Print(s)
442446
fmt.Print("\n")
443447
}
444448

445-
func sayTodo(s interface{}) {
449+
func sayTodo(s string) {
446450
fmt.Print(" ☐ ")
447451
fmt.Print(s)
448452
fmt.Print("\n")

0 commit comments

Comments
 (0)