-
Notifications
You must be signed in to change notification settings - Fork 10
/
msg.go
40 lines (37 loc) · 1.13 KB
/
msg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package actions
import (
"fmt"
"os"
"strings"
"github.com/aviator-co/av/internal/git"
"github.com/aviator-co/av/internal/utils/colors"
"github.com/kr/text"
)
func msgRebaseResult(rebase *git.RebaseResult) {
switch rebase.Status {
case git.RebaseAlreadyUpToDate:
_, _ = fmt.Fprint(os.Stderr, " - already up to date\n")
case git.RebaseUpdated:
_, _ = fmt.Fprint(os.Stderr, " - ", colors.Success("rebased without conflicts"), "\n")
case git.RebaseConflict:
_, _ = fmt.Fprint(os.Stderr,
" - ", colors.Failure("rebase conflict: ", rebase.ErrorHeadline), "\n",
colors.Faint(text.Indent(strings.TrimSpace(rebase.Hint), " ")),
"\n",
)
_, _ = fmt.Fprint(
os.Stderr,
" - resolve the conflicts and continue the sync with ",
colors.CliCmd("av stack sync --continue"),
"\n",
)
_, _ = fmt.Fprint(os.Stderr,
" - ",
colors.Warning("NOTE: do not use the "), colors.CliCmd("git rebase"),
colors.Warning(" command directly: use "), colors.CliCmd("av stack sync"),
colors.Warning(" instead"), "\n",
)
case git.RebaseAborted, git.RebaseNotInProgress:
// these should be handled externally
}
}