diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a7e72e..ae5572e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This file logs the changes that are actually interesting to users (new features, changed functionality, fixed bugs). +# Version 1.9 (in development) + +- Add `bat version` command to print just the version number and exit. + # Version 1.8 (2021-11-09) - Compatibility with read-only source files. When packing, file permissions are no longer copied. This means that BAT can modify paths in packed files, even when the source files were read-only. diff --git a/blender_asset_tracer/cli/__init__.py b/blender_asset_tracer/cli/__init__.py index 04120d8..f6bcd18 100644 --- a/blender_asset_tracer/cli/__init__.py +++ b/blender_asset_tracer/cli/__init__.py @@ -24,7 +24,7 @@ import datetime import logging import time -from . import blocks, common, pack, list_deps +from . import blocks, common, pack, list_deps, version def cli_main(): @@ -80,6 +80,7 @@ def cli_main(): blocks.add_parser(subparsers) pack.add_parser(subparsers) list_deps.add_parser(subparsers) + version.add_parser(subparsers) args = parser.parse_args() config_logging(args) diff --git a/blender_asset_tracer/cli/version.py b/blender_asset_tracer/cli/version.py new file mode 100644 index 0000000..dd16011 --- /dev/null +++ b/blender_asset_tracer/cli/version.py @@ -0,0 +1,32 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ***** END GPL LICENCE BLOCK ***** +# +# (c) 2021, Blender Foundation - Sybren A. Stüvel +"""Print version of BAT and exit.""" +from blender_asset_tracer import __version__ + + +def add_parser(subparsers): + """Add argparser for this subcommand.""" + + parser = subparsers.add_parser("version", help=__doc__) + parser.set_defaults(func=cli_version) + + +def cli_version(_): + print(__version__)