File tree Expand file tree Collapse file tree 4 files changed +30
-6
lines changed Expand file tree Collapse file tree 4 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ require (
7
7
github.com/codecrafters-io/logstream v0.0.0-20221026224152-2d9b2ed6d71c
8
8
github.com/fatih/color v1.13.0
9
9
github.com/levigross/grequests v0.0.0-20190908174114-253788527a1a
10
+ github.com/mitchellh/go-wordwrap v1.0.1
10
11
github.com/otiai10/copy v1.7.0
11
12
github.com/stretchr/testify v1.5.1
12
13
)
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope
50
50
github.com/mattn/go-isatty v0.0.12 /go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU =
51
51
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y =
52
52
github.com/mattn/go-isatty v0.0.14 /go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94 =
53
+ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0 =
54
+ github.com/mitchellh/go-wordwrap v1.0.1 /go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0 =
53
55
github.com/nxadm/tail v1.4.4 /go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A =
54
56
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE =
55
57
github.com/nxadm/tail v1.4.8 /go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU =
Original file line number Diff line number Diff line change 5
5
"github.com/codecrafters-io/cli/internal/utils"
6
6
logstream_consumer "github.com/codecrafters-io/logstream/consumer"
7
7
"github.com/fatih/color"
8
+ wordwrap "github.com/mitchellh/go-wordwrap"
8
9
cp "github.com/otiai10/copy"
9
10
"io"
10
11
"io/ioutil"
@@ -65,6 +66,24 @@ func TestCommand() int {
65
66
return 1
66
67
}
67
68
69
+ if createSubmissionResponse .OnInitSuccessMessage != "" {
70
+ fmt .Println ("" )
71
+
72
+ wrapped := wordwrap .WrapString (createSubmissionResponse .OnInitSuccessMessage , 79 )
73
+ for _ , line := range strings .Split (wrapped , "\n " ) {
74
+ fmt .Println (fmt .Sprintf ("\033 [1;92m%s\033 [0m" , line ))
75
+ }
76
+ }
77
+
78
+ if createSubmissionResponse .OnInitWarningMessage != "" {
79
+ fmt .Println ("" )
80
+
81
+ wrapped := wordwrap .WrapString (createSubmissionResponse .OnInitWarningMessage , 79 )
82
+ for _ , line := range strings .Split (wrapped , "\n " ) {
83
+ fmt .Println (fmt .Sprintf ("\033 [31m%s\033 [0m" , line ))
84
+ }
85
+ }
86
+
68
87
fmt .Println ("" )
69
88
err = streamLogs (createSubmissionResponse .LogstreamUrl )
70
89
if err != nil {
Original file line number Diff line number Diff line change @@ -11,12 +11,14 @@ import (
11
11
)
12
12
13
13
type CreateSubmissionResponse struct {
14
- Id string `json:"id"`
15
- ErrorMessage string `json:"error_message"`
16
- IsError bool `json:"is_error"`
17
- LogstreamUrl string `json:"logstream_url"`
18
- OnFailureMessage string `json:"on_failure_message"`
19
- OnSuccessMessage string `json:"on_success_message"`
14
+ Id string `json:"id"`
15
+ ErrorMessage string `json:"error_message"`
16
+ IsError bool `json:"is_error"`
17
+ LogstreamUrl string `json:"logstream_url"`
18
+ OnFailureMessage string `json:"on_failure_message"`
19
+ OnSuccessMessage string `json:"on_success_message"`
20
+ OnInitSuccessMessage string `json:"on_init_success_message"`
21
+ OnInitWarningMessage string `json:"on_init_warning_message"`
20
22
}
21
23
22
24
type FetchSubmissionResponse struct {
You can’t perform that action at this time.
0 commit comments