CLI: Add a --version option to display the YOGA's version

This commit is contained in:
Fabien LOISON 2021-08-27 11:35:39 +02:00
parent 0fb70bdc3a
commit 3a31472120
No known key found for this signature in database
GPG Key ID: FF90CA148348048E
4 changed files with 10 additions and 0 deletions

View File

@ -64,6 +64,7 @@ Changelog
* JPEG optimization has been improved by using some optimizations from
MozJPEG after the Guetzli encoding (from 2.4 % to 7.3 % of additional size
reduction)
* CLI: add a ``--version`` option to get YOGA's version
* **For packagers:**
* new dependency to `mozjpeg-lossless-optimization

View File

@ -12,6 +12,7 @@ Command Line Interface
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
The YOGA command line interface is divided in two sub-commands:

View File

@ -4,6 +4,7 @@ from functools import partial
from .image.cli import add_image_cli_options
from .model.cli import add_model_cli_options
from .version import VERSION
def _type_path(mode, string):
@ -71,6 +72,12 @@ def generate_main_cli():
prog="yoga",
usage="%(prog)s [-h] {image,model} [options...] input output",
)
parser.add_argument(
"--version",
action="version",
version="%%(prog)s %s" % VERSION,
)
subparsers = parser.add_subparsers(dest="subcommand")
image_parser = subparsers.add_parser(

1
yoga/version.py Normal file
View File

@ -0,0 +1 @@
VERSION = "1.0.0"