Skip to content

Commit

Permalink
Add version command
Browse files Browse the repository at this point in the history
The version is determined at runtime by importlib.metadata.version().
  • Loading branch information
jfrost-mo committed Jul 11, 2023
1 parent 732d5e2 commit c9b27c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/CSET/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import logging
from pathlib import Path
import os
from importlib.metadata import version


def main():
Expand All @@ -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")

Expand Down

0 comments on commit c9b27c9

Please sign in to comment.