Skip to content

Commit

Permalink
Cooler CLI spinner (#309)
Browse files Browse the repository at this point in the history
Closes: #293

Use a better looking spinner in the CLI

Hoping this won't be an issue on any terminals 🤞
  • Loading branch information
fohrloop authored May 26, 2024
1 parent 9cfb867 commit 05821df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wakepy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def get_startup_text(mode: ModeName) -> str:


def wait_until_keyboardinterrupt() -> None:
spinning_chars = ["|", "/", "-", "\\"]
spinner_symbols = ["⢎⡰", "⢎⡡", "⢎⡑", "⢎⠱", "⠎⡱", "⢊⡱", "⢌⡱", "⢆⡱"]
try:
for char in itertools.cycle(spinning_chars): # pragma: no branch
print("\r" + char + r" [Press Ctrl+C to exit]", end="")
time.sleep(1)
for spinner_symbol in itertools.cycle(spinner_symbols): # pragma: no branch
print("\r" + spinner_symbol + r" [Press Ctrl+C to exit] ", end="")
time.sleep(0.8)
except KeyboardInterrupt:
pass

Expand Down

0 comments on commit 05821df

Please sign in to comment.