manrajgrover / halo

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

Fixes #42: No text should be shown on KeyboardInterrupt #43

Closed manrajgrover closed 6 years ago

manrajgrover commented 6 years ago

Description of new feature, or changes

Currently, when KeyboardInterrupt is raised, handler persists current text and shows failed. We should allow user to choose the preferable output and not handle it ourselves.

Checklist

Related Issues and Discussions

Fixes #42

People to notify

@JungWinter

winterjung commented 6 years ago

I agree. It seems better self.stop() instead of throwing a failure message. If we allow user to choose showing failure message or not, how we provide choices to user?

manrajgrover commented 6 years ago

@JungWinter Users can catch the error raised and handle it according to their need.

winterjung commented 6 years ago

Oh, I misunderstood. Yes it is better. If user want, they do just like this.

try:
    spinner.start(text="loading")
    time.sleep(999)
except KeyboardInterrupt:
    spinner.fail(spinner.text)
manrajgrover commented 6 years ago

@JungWinter Yeps!