Skip to content

Commit

Permalink
Handle --version flag before anything
Browse files Browse the repository at this point in the history
  • Loading branch information
gituser12981u2 committed Jul 7, 2024
1 parent 9cafed5 commit f55fd6c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion audio_visualizer/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit f55fd6c

Please sign in to comment.