Skip to content

Commit f12876e

Browse files
committed
#33 Minor changes to help messages and logging, by Piotr
1 parent f62a641 commit f12876e

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

cli/students.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get(
2828
),
2929
sort: bool = typer.Option(False, "-s", "--sort", help="Sort alphabetically"),
3030
sort_reverse: bool = typer.Option(
31-
False, "-r", "--reverse", help="Sort in reverse order"
31+
False, "-r", "--reverse", help="Sort alphabetically in reverse order"
3232
),
3333
):
3434
"""
@@ -83,8 +83,6 @@ def holidays(
8383
students = api.get()
8484

8585
if not students:
86-
if not quiet:
87-
typer.echo("No students found!")
8886
sys.exit(1)
8987

9088
result = 0 if all(api.delete(s) for s in students) else 1

pythonanywhere/students.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ def get(self):
3434
try:
3535
result = self.api.get()
3636
student_usernames = [student["username"] for student in result["students"]]
37-
logger.info(snakesay(f"{len(student_usernames)} students found!"))
37+
count = len(student_usernames)
38+
msg = f"You have {count} students!" if count else "Currently you don't have any students."
39+
logger.info(snakesay(msg))
3840
return student_usernames
3941
except Exception as e:
4042
logger.warning(snakesay(str(e)))

tests/test_cli_students.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,3 @@ def test_exits_with_error_when_none_student_removed(
134134

135135
assert result.exit_code == 1
136136
assert not mock_students_delete.called
137-
assert "No students found" in result.stdout

0 commit comments

Comments
 (0)