Skip to content
Snippets Groups Projects
Commit 3bd6078b authored by Johann Jacobsohn's avatar Johann Jacobsohn
Browse files

add --version argument

parent 4de34d53
No related branches found
No related tags found
No related merge requests found
include papersurfer/_version.txt
0.10.0
...@@ -403,6 +403,13 @@ class PostDialog(urwid.WidgetWrap): ...@@ -403,6 +403,13 @@ class PostDialog(urwid.WidgetWrap):
self.doi_result.set_text("invalid doi") self.doi_result.set_text("invalid doi")
def get_version():
from pathlib import Path
pkgbase = Path(__file__).parent
with open(f"{pkgbase}/_version.txt", "r") as f:
return f.read()
def parse_args(): def parse_args():
"""Parse command line arguments and config file.""" """Parse command line arguments and config file."""
parser = configargparse.ArgParser( parser = configargparse.ArgParser(
...@@ -421,6 +428,8 @@ def parse_args(): ...@@ -421,6 +428,8 @@ def parse_args():
help="Dump mattermost paper posts to stdout and exit") help="Dump mattermost paper posts to stdout and exit")
parser.add('--dump-bibtex', action='store_true', parser.add('--dump-bibtex', action='store_true',
help="Dump mattermost paper posts to stdout and exit") help="Dump mattermost paper posts to stdout and exit")
parser.add('--version', action='version',
version=get_version())
options = parser.parse_args() options = parser.parse_args()
if not options.url: if not options.url:
......
...@@ -6,11 +6,12 @@ HERE = pathlib.Path(__file__).parent ...@@ -6,11 +6,12 @@ HERE = pathlib.Path(__file__).parent
# The text of the README file # The text of the README file
README = (HERE / "README.md").read_text() README = (HERE / "README.md").read_text()
VERSION = (HERE / "papersurfer/_version.txt").read_text()
# This call to setup() does all the work # This call to setup() does all the work
setup( setup(
name="papersurfer", name="papersurfer",
version="0.7.0", version=VERSION,
description="", description="",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment