diff --git a/src/CSET/__init__.py b/src/CSET/__init__.py index 7e1df77ae..4f026a385 100644 --- a/src/CSET/__init__.py +++ b/src/CSET/__init__.py @@ -20,6 +20,7 @@ import logging from pathlib import Path import os +from importlib.metadata import version def main(): @@ -34,6 +35,10 @@ def main(): default=0, help="increase output verbosity, may be specified multiple times", ) + parser.add_argument( + "--version", action="version", version=f"CSET v{version('CSET')}" + ) + # https://docs.python.org/3/library/argparse.html#sub-commands subparsers = parser.add_subparsers(title="subcommands", dest="subparser")