Skip to content

Commit

Permalink
Merge pull request #44 from gituser12981u2/fix/handle-version-flag-be…
Browse files Browse the repository at this point in the history
…fore-imports

Handle --version flag before anything
  • Loading branch information
gituser12981u2 authored Jul 7, 2024
2 parents 9cafed5 + f55fd6c commit 3aeda15
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 3aeda15

Please sign in to comment.