Skip to content

Commit

Permalink
Refactor error message in run() function to suggest running codecraft…
Browse files Browse the repository at this point in the history
…ers test instead of an unknown command.
  • Loading branch information
rohitpaulk committed Apr 30, 2024
1 parent 7c39787 commit c099bfe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/codecrafters/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ func run() error {
"": // no argument
flag.Usage()
default:
return fmt.Errorf("Unknown command '%s'. Did you mean to run `codecrafters test`?\n\nRun `codecrafters help` for a list of available commands.", cmd)
red := color.New(color.FgRed).SprintFunc()
fmt.Printf(red("Unknown command '%s'. Did you mean to run `codecrafters test`?\n\n"), cmd)
fmt.Printf("Run `codecrafters help` for a list of available commands.\n")

return fmt.Errorf("")
}

return nil
Expand Down

0 comments on commit c099bfe

Please sign in to comment.