Add version function support to CLI
This commit is contained in:
parent
221494ed1b
commit
e866335918
|
@ -51,6 +51,18 @@ default_store_data = {
|
|||
}
|
||||
|
||||
|
||||
#
|
||||
# Version function
|
||||
#
|
||||
def print_version(ctx, param, value):
|
||||
if not value or ctx.resilient_parsing:
|
||||
return
|
||||
from pkg_resources import get_distribution
|
||||
version = get_distribution('pvc').version
|
||||
click.echo(f'Parallel Virtual Cluster version {version}')
|
||||
ctx.exit()
|
||||
|
||||
|
||||
#
|
||||
# Data store handling functions
|
||||
#
|
||||
|
@ -4793,6 +4805,10 @@ def task_init(confirm_flag, overwrite_flag):
|
|||
'-u', '--unsafe', '_unsafe', envvar='PVC_UNSAFE', is_flag=True, default=False,
|
||||
help='Allow unsafe operations without confirmation/"--yes" argument.'
|
||||
)
|
||||
@click.option(
|
||||
'--version', is_flag=True, callback=print_version,
|
||||
expose_value=False, is_eager=True
|
||||
)
|
||||
def cli(_cluster, _debug, _quiet, _unsafe):
|
||||
"""
|
||||
Parallel Virtual Cluster CLI management tool
|
||||
|
|
Loading…
Reference in New Issue