bump version and allow use of --version to see it

This commit is contained in:
Soren I. Bjornstad 2022-01-23 17:27:10 -06:00
parent 4a6e4e7bc0
commit 572c3d0316
4 changed files with 13 additions and 5 deletions

View File

@ -18,9 +18,9 @@ copyright = '2021 Soren Bjornstad'
author = 'Soren Bjornstad' author = 'Soren Bjornstad'
# The short X.Y version # The short X.Y version
version = "0.1.4" version = "0.1.5"
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = "0.1.4" release = "0.1.5"
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------

View File

@ -9,7 +9,7 @@ with open("README.md", "r") as fh:
setuptools.setup( setuptools.setup(
name="tzk", name="tzk",
version="0.1.4", version="0.1.5",
author="Soren I. Bjornstad", author="Soren I. Bjornstad",
author_email="zettelkasten@sorenbjornstad.com", author_email="zettelkasten@sorenbjornstad.com",
description="Build tool for TiddlyWiki Zettelkasten", description="Build tool for TiddlyWiki Zettelkasten",

View File

@ -13,6 +13,8 @@ from tzk import tw
from tzk.util import (BuildError, fail, numerize, require_dependencies, pushd, from tzk.util import (BuildError, fail, numerize, require_dependencies, pushd,
TZK_VERSION) TZK_VERSION)
VERSION_INFO = f"tzk version {TZK_VERSION}"
class CliCommand(ABC): class CliCommand(ABC):
""" """
@ -180,7 +182,7 @@ class VersionCommand(CliCommand):
pass pass
def execute(self, args: argparse.Namespace) -> None: def execute(self, args: argparse.Namespace) -> None:
print(f"tzk version {TZK_VERSION}") print(VERSION_INFO)
class BuildCommand(CliCommand): class BuildCommand(CliCommand):
@ -407,6 +409,12 @@ def launch():
epilog="For full documentation, see https://tzk.readthedocs.io/en/latest/.", epilog="For full documentation, see https://tzk.readthedocs.io/en/latest/.",
formatter_class=argparse.RawDescriptionHelpFormatter formatter_class=argparse.RawDescriptionHelpFormatter
) )
parser.add_argument(
"--version",
action="version",
version=VERSION_INFO,
help=VersionCommand.help
)
subparsers = parser.add_subparsers() subparsers = parser.add_subparsers()
for command in sorted(CliCommand.__subclasses__(), key=lambda i: i.__name__): for command in sorted(CliCommand.__subclasses__(), key=lambda i: i.__name__):

View File

@ -10,7 +10,7 @@ import sys
from typing import Any, Callable, Dict, NoReturn from typing import Any, Callable, Dict, NoReturn
TZK_VERSION = "0.1.4" TZK_VERSION = "0.1.5"
class BuildError(Exception): class BuildError(Exception):