Skip to content

Commit

Permalink
_state: clear the spinner entirely when done
Browse files Browse the repository at this point in the history
Closes #171.
  • Loading branch information
woodruffw committed Dec 3, 2021
1 parent b0f2615 commit 39297db
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pip_audit/_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ def update(self) -> None:
line = f"{self.phases[i]} {self.message}"
self._writeln_truncated(line)

def finish(self) -> None:
"""
Finish the progress spinner.
This method is overridden from `BaseSpinner` to customize the spinner's termination
behavior: instead of finishing by printing a newline and leaving the last spinner state
on the terminal, we clear the spinner entirely and reset the line's state, leaving
no trace of the spinner at all.
"""
self.writeln("")
self.file.write("\r")
self.file.flush()

def update_state(self, message: str) -> None:
"""
Update the state message for the progress spinner.
Expand Down

0 comments on commit 39297db

Please sign in to comment.