Skip to content

Commit

Permalink
add support for --version/-v args
Browse files Browse the repository at this point in the history
  • Loading branch information
ceuk committed Dec 28, 2022
1 parent e91c639 commit 40a460d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
14 changes: 10 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import setuptools
from setuptools import setup, find_packages
from distutils.util import convert_path

main_ns = {}
ver_path = convert_path('spotui/version.py')
with open(ver_path) as ver_file:
exec(ver_file.read(), main_ns)

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
setup(
name="spotui",
version="0.1.18",
version=main_ns['__version__'],
author="ceuk",
description="Spotify TUI",
long_description=long_description,
long_description_content_type="text/markdown",
keywords="spotify spotifytui",
url="https://github.com/ceuk/spotui",
packages=setuptools.find_packages(),
packages=find_packages(),
license="MIT",
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
13 changes: 13 additions & 0 deletions spotui/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import curses
import sys
import argparse
from contextlib import contextmanager, redirect_stderr, redirect_stdout
from os import devnull
from spotui.src.ui import App
from spotui.version import __version__

parser = argparse.ArgumentParser(
prog = 'SpoTUI',
description = 'Spotify in the terminal')
parser.add_argument('-v', '--version',
action='store_true')
args = parser.parse_args()

if args.version:
print(__version__)
sys.exit(0)

@contextmanager
def suppress_stdout_stderr():
Expand Down
1 change: 1 addition & 0 deletions spotui/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.1.20'

0 comments on commit 40a460d

Please sign in to comment.