Skip to content

Instantly share code, notes, and snippets.

@lamchau
Created October 8, 2020 07:51
Show Gist options
  • Save lamchau/526ec33393f37f4db1d8cff6727d356c to your computer and use it in GitHub Desktop.
Save lamchau/526ec33393f37f4db1d8cff6727d356c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
from itertools import cycle
import time
# https://github.com/yarnpkg/berry/blob/e6e035c901ce921af890be9401076f0123e5393d/packages/yarnpkg-core/sources/StreamReport.ts
PROGRESS_FRAMES = cycle(['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'])
for i in range(60):
frame = next(PROGRESS_FRAMES)
sys.stdout.write(f'\r{frame} \033[K')
time.sleep(0.05)
sys.stdout.write('\r\033[K')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment