From ba5e19dd5b9fa4c0d88d5938ce820141f271350a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rud=C3=A1=20Moura?= Date: Wed, 27 Oct 2021 14:34:25 -0300 Subject: [PATCH] Add command version to bonfire (#142) * Add command 'version' Co-authored-by: Brandon Schneider --- bonfire/bonfire.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bonfire/bonfire.py b/bonfire/bonfire.py index d625287b..26cd1606 100755 --- a/bonfire/bonfire.py +++ b/bonfire/bonfire.py @@ -6,6 +6,12 @@ import sys import warnings +from importlib.metadata import version, PackageNotFoundError +try: + __version__ = version("crc-bonfire") +except PackageNotFoundError: + __version__ = "(unknown)" + from tabulate import tabulate from wait_for import TimedOutError @@ -1105,6 +1111,12 @@ def _err_handler(err): click.echo(pod_name) +@main.command("version") +def _cmd_version(): + """Print bonfire version""" + click.echo("bonfire version " + __version__) + + @config.command("write-default") @click.argument("path", required=False, type=str) def _cmd_write_default_config(path):