Clean progressbar when needed.

This commit is contained in:
Sergio Martínez Portela 2021-12-17 09:58:19 +01:00
parent 99274cf6d7
commit 34029f56f5
2 changed files with 7 additions and 0 deletions

View File

@ -189,6 +189,7 @@ def archive_to_dir(directory, url):
with open('index.html', 'wt') as f: with open('index.html', 'wt') as f:
f.write(archived_content.prettify()) f.write(archived_content.prettify())
progbar.clean()
os.chdir(current_path) os.chdir(current_path)

View File

@ -28,3 +28,9 @@ class ProgressBar:
def next_iter(self, msg=''): def next_iter(self, msg=''):
self.current_element += 1 self.current_element += 1
self.show(msg) self.show(msg)
def clean(self):
print('\r' # Go to the start of the line
'\x1b[K' # Clear line
'\x1b[0m', # Restart the "style"
end='')