Skip to content

Commit 9dd0499

Browse files
committed
Move printResult to submitCmdContext
printing really depends on the submitCmd rather than the submission itself
1 parent d0afa9f commit 9dd0499

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

cmd/submit.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,20 @@ func (s *submitCmdContext) _documents(filepaths []string, exercise workspace.Exe
276276
return docs, nil
277277
}
278278

279+
func (s *submitCmdContext) printResult() {
280+
msg := `
281+
282+
Your solution has been submitted successfully.
283+
%s
284+
`
285+
suffix := "View it at:\n\n "
286+
if s.metadata.AutoApprove && s.metadata.Team == "" {
287+
suffix = "You can complete the exercise and unlock the next core exercise at:\n"
288+
}
289+
fmt.Fprintf(Err, msg, suffix)
290+
fmt.Fprintf(Out, " %s\n\n", s.metadata.URL)
291+
}
292+
279293
type submission struct {
280294
documents []workspace.Document
281295
metadata *workspace.ExerciseMetadata
@@ -344,20 +358,6 @@ func (s submission) submit(usrCfg *viper.Viper) error {
344358
return nil
345359
}
346360

347-
func (s submission) printResult() {
348-
msg := `
349-
350-
Your solution has been submitted successfully.
351-
%s
352-
`
353-
suffix := "View it at:\n\n "
354-
if s.metadata.AutoApprove && s.metadata.Team == "" {
355-
suffix = "You can complete the exercise and unlock the next core exercise at:\n"
356-
}
357-
fmt.Fprintf(Err, msg, suffix)
358-
fmt.Fprintf(Out, " %s\n\n", s.metadata.URL)
359-
}
360-
361361
func (s submission) validate() error {
362362
if s.metadata.ID == "" {
363363
return errors.New("id is empty")

0 commit comments

Comments
 (0)