From ef87a47c3357060349de3399ab22a35688a52fab Mon Sep 17 00:00:00 2001 From: Sepand Haghighi Date: Thu, 8 Aug 2024 21:39:10 +0330 Subject: [PATCH] Exit message (#92) * fix : EXIT_MESSAGE added * fix : main function exit mode modified * fix : minor edit in exit message * doc : CHANGELOG.md updated --- CHANGELOG.md | 1 + nafas/__main__.py | 8 ++++++-- nafas/params.py | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60c59a3..637ae90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `Python 3.12` added to `test.yml` - `Python 3.5` support dropped - CLI mode updated +- Exit message updated - `README.md` modified ## [0.6] - 2022-06-22 ### Added diff --git a/nafas/__main__.py b/nafas/__main__.py index 4020589..8bab265 100644 --- a/nafas/__main__.py +++ b/nafas/__main__.py @@ -4,7 +4,7 @@ import argparse from nafas.functions import description_print, get_input_standard, input_filter from nafas.functions import get_program_data, program_description_print, run -from nafas.params import NAFAS_VERSION +from nafas.params import NAFAS_VERSION, EXIT_MESSAGE from art import tprint @@ -34,7 +34,11 @@ def main(): input("Press [R] to restart or any other key to exit.")) if INPUTINDEX.upper() != "R": EXIT_FLAG = True + print(EXIT_MESSAGE) if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + print("\n" + EXIT_MESSAGE) diff --git a/nafas/params.py b/nafas/params.py index 9d8a4e8..8400fdd 100644 --- a/nafas/params.py +++ b/nafas/params.py @@ -20,6 +20,8 @@ SOUND_WARNING_MESSAGE = "Your device is not compatible with our underlying sound-playing library. You can refer to https://github.com/openscilab/nava." +EXIT_MESSAGE = "See you. Bye!" + PROGRAM_DESCRIPTION = """Program Details : Name : {0}