diff --git a/cmd/submit.go b/cmd/submit.go index 7c83824ab..8e94e4d08 100644 --- a/cmd/submit.go +++ b/cmd/submit.go @@ -95,17 +95,7 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error { return err } - msg := ` - - Your solution has been submitted successfully. - %s -` - suffix := "View it at:\n\n " - if metadata.AutoApprove && metadata.Team == "" { - suffix = "You can complete the exercise and unlock the next core exercise at:\n" - } - fmt.Fprintf(Err, msg, suffix) - fmt.Fprintf(Out, " %s\n\n", metadata.URL) + ctx.printResult(metadata) return nil } @@ -342,6 +332,20 @@ func (ctx *submitContext) submitRequest(id string, docs []workspace.Document) er return nil } +func (ctx *submitContext) printResult(metadata *workspace.ExerciseMetadata) { + msg := ` + + Your solution has been submitted successfully. + %s +` + suffix := "View it at:\n\n " + if metadata.AutoApprove && metadata.Team == "" { + suffix = "You can complete the exercise and unlock the next core exercise at:\n" + } + fmt.Fprintf(Err, msg, suffix) + fmt.Fprintf(Out, " %s\n\n", metadata.URL) +} + func init() { RootCmd.AddCommand(submitCmd) }