Skip to content

Commit 2b43de4

Browse files
committed
Add colors to verify output
1 parent cbcfd05 commit 2b43de4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

cli/commands/verify.py

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

2727

28+
def print_output(output: GitAutograderOutput) -> None:
29+
color = (
30+
"bright_green"
31+
if output.status == GitAutograderStatus.SUCCESSFUL
32+
else "bright_red"
33+
if output.status == GitAutograderStatus.UNSUCCESSFUL
34+
else "bright_yellow"
35+
)
36+
info("Verification completed.")
37+
info("")
38+
info(f"{click.style('Status:', bold=True)} {click.style(output.status, fg=color)}")
39+
info(click.style("Comments:", bold=True))
40+
print("\n".join([f"\t- {comment}" for comment in (output.comments or [])]))
41+
42+
2843
def submit_progress(output: GitAutograderOutput, verbose: bool) -> None:
2944
# TODO: handle edge cases where the student might have deleted progress themselves
3045
gitmastery_root = find_gitmastery_root()
@@ -160,10 +175,5 @@ def verify(ctx: click.Context) -> None:
160175
)
161176

162177
assert output is not None
163-
info("Verification completed.")
164-
info("")
165-
info(f"{click.style('Status:', bold=True)} {output.status}")
166-
info(click.style("Comments:", bold=True))
167-
print("\n".join([f"\t- {comment}" for comment in (output.comments or [])]))
168-
178+
print_output(output)
169179
submit_progress(output, verbose)

0 commit comments

Comments
 (0)