diff --git a/setup.py b/setup.py index 03f4ec5..12369d2 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/spotui/__main__.py b/spotui/__main__.py index 8db2a33..36af948 100644 --- a/spotui/__main__.py +++ b/spotui/__main__.py @@ -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(): diff --git a/spotui/version.py b/spotui/version.py new file mode 100644 index 0000000..e160d93 --- /dev/null +++ b/spotui/version.py @@ -0,0 +1 @@ +__version__ = '0.1.20'