From f55fd6c663ab77042bd736306575da630474f678 Mon Sep 17 00:00:00 2001 From: gituser12981u2 Date: Sun, 7 Jul 2024 12:58:51 -0700 Subject: [PATCH] Handle --version flag before anything --- audio_visualizer/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/audio_visualizer/__init__.py b/audio_visualizer/__init__.py index 2a9c39f..8923d4b 100755 --- a/audio_visualizer/__init__.py +++ b/audio_visualizer/__init__.py @@ -1,10 +1,16 @@ +import sys + +# Check if the --version flag is used and handle it directly +if '--version' in sys.argv: + print("audio_visualizer 1.0.0") + sys.exit(0) + from audio_visualizer.visualizer import AudioVisualizer import argparse import logging import logging.handlers import time import os -import sys from sys import platform from lupa import LuaRuntime @@ -143,6 +149,12 @@ def main(): default=config['settings']['sample_rate'], help="Sampling rate; default is 44100", ) + parser.add_argument( + "--version", + action="version", + version="audio_visualizer 1.0.0", + help="Show program's version number and exit." + ) args = parser.parse_args() visualizer = AudioVisualizer(