Skip to content

Commit

Permalink
refactor: return all command error messages instead
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi authored and MaferMazu committed Aug 26, 2024
1 parent 821c5fc commit 018b455
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions tutorpicasso/commands/run_extra_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,29 @@ def validate_commands(commands: Any) -> str:
if "tutor" in command.lower():
continue

if find_tutor_misspelled(command):
misspelled_commands.append(command)
else:
invalid_commands.append(command)
if find_tutor_misspelled(command):
misspelled_commands.append(command)
else:
invalid_commands.append(command)

error_message = ""
if invalid_commands:
error_message += (
f"Found some issues with the commands:\n\n"
f"=> Invalid commands: {', '.join(invalid_commands)}\n"
)

if misspelled_commands:
error_message += (
f"=> Misspelled commands: {', '.join(misspelled_commands)}\n"
)

error_message = ""

if invalid_commands:
error_message += (
f"Found some issues with the commands:\n\n"
f"=> Invalid commands: {', '.join(invalid_commands)}\n"
)

if misspelled_commands:
error_message += (
f"=> Misspelled commands: {', '.join(misspelled_commands)}\n"
)

if error_message:
error_message += (
"Take a look at the official Tutor commands: "
"https://docs.tutor.edly.io/reference/cli/index.html"
)
return error_message
return ""
if error_message:
error_message += (
"Take a look at the official Tutor commands: "
"https://docs.tutor.edly.io/reference/cli/index.html"
)
return error_message


def run_command(command: str) -> None:
Expand Down

0 comments on commit 018b455

Please sign in to comment.