Skip to content

Commit 4fda8a9

Browse files
authored
Remove extra newline cx deploy (#1375)
1 parent 4ef2fa6 commit 4fda8a9

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

cli/cmd/deploy.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,20 @@ func mergeResultMessages(results []schema.DeployResult) string {
264264
}
265265
}
266266

267-
return strings.Join(okMessages, "\n") + "\n\n" + strings.Join(errMessages, "\n")
267+
output := ""
268+
269+
if len(okMessages) > 0 {
270+
output += strings.Join(okMessages, "\n")
271+
if len(errMessages) > 0 {
272+
output += "\n\n"
273+
}
274+
}
275+
276+
if len(errMessages) > 0 {
277+
output += strings.Join(errMessages, "\n")
278+
}
279+
280+
return output
268281
}
269282

270283
func didAllResultsError(results []schema.DeployResult) bool {

pkg/lib/errors/message.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ import (
2525
)
2626

2727
func PrintError(err error, strs ...string) {
28-
fmt.Println(errorStr(err, strs...))
28+
fmt.Println(ErrorStr(err, strs...))
2929
// PrintStacktrace(err)
3030
}
3131

3232
func PrintErrorForUser(err error, strs ...string) {
33-
print.BoldFirstLine(errorStr(err, strs...))
33+
print.BoldFirstLine(ErrorStr(err, strs...))
3434
// PrintStacktrace(err)
3535
}
3636

37-
func errorStr(err error, strs ...string) string {
37+
func ErrorStr(err error, strs ...string) string {
3838
wrappedErr := Wrap(err, strs...)
3939
return "error: " + strings.TrimSpace(Message(wrappedErr))
4040
}

pkg/operator/resources/resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func Deploy(projectBytes []byte, configFileName string, configBytes []byte, forc
115115
api, msg, err := UpdateAPI(&apiConfig, projectID, force)
116116
results[i].Message = msg
117117
if err != nil {
118-
results[i].Error = errors.Message(err)
118+
results[i].Error = errors.ErrorStr(err)
119119
} else {
120120
results[i].API = api
121121
}

0 commit comments

Comments
 (0)