manrajgrover / halo

💫 Beautiful spinners for terminal, IPython and Jupyter
MIT License
2.9k stars 149 forks source link

Fix issue 157 #160

Closed LowLevelLover closed 1 year ago

LowLevelLover commented 3 years ago

157

Description of new feature, or changes

Change decorator implementation so old codes still work and issue #157 could implement in a new way

Code Example:

from halo import Halo
from time import sleep

# should write stop_text and stop_symbol to implement stop_and_persist function
@Halo(text='Loading {task}', spinner='line')
def run_task(halo_iter=[], stop_text='', stop_symbol=' '):
    sleep(3)

tasks1 = ['breakfest', 'launch', 'dinner']
tasks2 = ['morning', 'noon', 'night']

run_task(halo_iter=tasks1, stop_symbol='🦄'.encode('utf-8'), stop_text='Task1 Finished')
run_task(halo_iter=tasks2, stop_text='Finished Time')

Checklist

Related Issues and Discussions

fixes #157

People to notify

@manrajgrover