diff --git a/CHANGELOG.md b/CHANGELOG.md index adf12be..0d2be4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added +- `--silent` argument - `clear_screen` function ### Changed - Restart mode updated diff --git a/README.md b/README.md index 14faada..2c5e10d 100644 --- a/README.md +++ b/README.md @@ -69,16 +69,37 @@ No need to walk away to take a break, just sit comfortably, run Nafas and let th - `pip install nafas==0.7` -### Exe Version (Only Windows) +### Exe Version + +⚠️ Only Windows + - Download [Exe-Version 0.7](https://github.com/sepandhaghighi/nafas/releases/download/v0.7/NAFAS-0.7.exe) - Run `NAFAS-0.7.exe` ## Usage -- Open `CMD`/`PowerShell` (Windows) or `Terminal` (Linux) -- Run `nafas` or `python -m nafas` (or run `NAFAS.exe`) -- Enter data +ℹ️ You can use `nafas`, `python -m nafas` or `NAFAS.exe` to run this program + +### Version + +```console +nafas --version +``` + +### Basic + +```console +nafas +``` + +### Silent Mode + +ℹ️ This mode will disable the sound playing system + +```console +nafas --silent +```
diff --git a/nafas/__main__.py b/nafas/__main__.py index bd9d91c..86843bc 100644 --- a/nafas/__main__.py +++ b/nafas/__main__.py @@ -16,12 +16,16 @@ def main(): """ parser = argparse.ArgumentParser() parser.add_argument('--version', help='version', nargs="?", const=1) + parser.add_argument('--silent', help='silent mode', nargs="?", const=1) args = parser.parse_args() + silent_flag = args.silent if args.version: print(NAFAS_VERSION) else: tprint("Nafas") tprint("v" + str(NAFAS_VERSION)) + if silent_flag: + tprint("Silent Mode") description_print() EXIT_FLAG = False while not EXIT_FLAG: @@ -29,7 +33,7 @@ def main(): filtered_data = input_filter(input_data) program_name, level, program_data = get_program_data(filtered_data) program_description_print(program_name, level, program_data) - run(program_data) + run(program_data, silent=silent_flag) INPUTINDEX = str( input("Press [R] to restart or any other key to exit.")) if INPUTINDEX.upper() != "R": diff --git a/nafas/functions.py b/nafas/functions.py index 0842470..18fb22e 100644 --- a/nafas/functions.py +++ b/nafas/functions.py @@ -283,15 +283,19 @@ def play_sound(sound_path, enable=True): _ = nava.play(sound_path, async_mode=True) -def run(program_data): +def run(program_data, silent=False): """ Run program. :param program_data: program data :type program_data: dict + :param silent: silent mode flag + :type silent: bool :return: None """ - sound_check_flag = sound_check() + sound_check_flag = False + if not silent: + sound_check_flag = sound_check() cycle = program_data["cycle"] ratio = program_data["ratio"] unit = program_data["unit"] diff --git a/test/test.py b/test/test.py index a6f4fe9..c6cae68 100644 --- a/test/test.py +++ b/test/test.py @@ -112,6 +112,24 @@ . . . ###################################################################### Well done! +>>> run({'cycle': 2, 'pre': 3, 'unit': 1, 'ratio': [1, 0, 3, 0]}, silent=True) +Preparing . . . +###################################################################### +Start +###################################################################### +Cycle : 1 (Remaining : 1) +- Inhale for 1 sec +. +- Exhale for 3 sec +. . . +###################################################################### +Cycle : 2 (Remaining : 0) +- Inhale for 1 sec +. +- Exhale for 3 sec +. . . +###################################################################### +Well done! >>> run({'cycle': 2, 'pre': 3, 'unit': 1, 'ratio': [1, 0, 3.3, 0]}) Preparing . . . ######################################################################