File tree 2 files changed +8
-18
lines changed
2 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import (
13
13
"os"
14
14
"os/signal"
15
15
"path/filepath"
16
- "regexp"
17
16
"runtime"
18
17
"strings"
19
18
"syscall"
@@ -825,6 +824,8 @@ type prettyErrorFormatter struct {
825
824
826
825
func (p * prettyErrorFormatter ) format (err error ) {
827
826
if err == nil {
827
+ // 🍒
828
+ p .printf ("\n " )
828
829
return
829
830
}
830
831
@@ -852,8 +853,8 @@ func (p *prettyErrorFormatter) format(err error) {
852
853
} else {
853
854
msg = errorWithoutChildren
854
855
}
855
- p .wrappedPrintf (
856
- "%s\n " ,
856
+ p .printf (
857
+ "%s" ,
857
858
textStyle .Render (msg ),
858
859
)
859
860
@@ -864,23 +865,16 @@ func (p *prettyErrorFormatter) format(err error) {
864
865
865
866
textStyle := lipgloss .NewStyle ().Foreground (lipgloss .Color ("#969696" )).Bold (false )
866
867
867
- p .wrappedPrintf (
868
+ p .printf (
868
869
"%s" ,
869
- textStyle .Render (errorWithoutChildren ),
870
+ textStyle .Render (": " + errorWithoutChildren ),
870
871
)
871
872
p .level ++
872
873
p .format (underErr )
873
874
}
874
875
875
- func (p * prettyErrorFormatter ) wrappedPrintf (format string , a ... interface {}) {
876
- s := lipgloss .NewStyle ().Width (ttyWidth ()).Render (
877
- fmt .Sprintf (format , a ... ),
878
- )
879
-
880
- // Not sure why, but lipgloss is adding extra spaces we need to remove.
881
- excessSpaceRe := regexp .MustCompile (`[[:blank:]]*\n[[:blank:]]*$` )
882
- s = excessSpaceRe .ReplaceAllString (s , "\n " )
883
-
876
+ func (p * prettyErrorFormatter ) printf (format string , a ... interface {}) {
877
+ s := fmt .Sprintf (format , a ... )
884
878
_ , _ = p .w .Write (
885
879
[]byte (
886
880
s ,
Original file line number Diff line number Diff line change @@ -42,10 +42,6 @@ func TestCommandHelp(t *testing.T) {
42
42
cmd []string
43
43
}
44
44
tests := []testCase {
45
- {
46
- name : "coder --help" ,
47
- cmd : []string {"--help" },
48
- },
49
45
{
50
46
name : "coder --help" ,
51
47
cmd : []string {"--help" },
You can’t perform that action at this time.
0 commit comments