From cf3a96317380e05f4efb465a2c2a45dee5f60052 Mon Sep 17 00:00:00 2001 From: Benex254 Date: Wed, 17 Jul 2024 15:01:03 +0300 Subject: [PATCH] feat(cli): add graceful exit --- fastanime/cli/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fastanime/cli/__init__.py b/fastanime/cli/__init__.py index 3f23768..c20f999 100644 --- a/fastanime/cli/__init__.py +++ b/fastanime/cli/__init__.py @@ -1,3 +1,5 @@ +import signal + import click from .. import __version__ @@ -17,6 +19,19 @@ } +# handle keyboard interupt +def handle_exit(signum, frame): + from .utils.tools import exit_app + from .utils.utils import clear + + clear() + + exit_app() + + +signal.signal(signal.SIGINT, handle_exit) + + @click.group( commands=commands, help="A command line application for streaming anime that provides a complete and featureful interface",