Add version function support to CLI
This commit is contained in:
parent
cbbab46b55
commit
39fd85fcc3
|
@ -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
|
# 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,
|
'-u', '--unsafe', '_unsafe', envvar='PVC_UNSAFE', is_flag=True, default=False,
|
||||||
help='Allow unsafe operations without confirmation/"--yes" argument.'
|
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):
|
def cli(_cluster, _debug, _quiet, _unsafe):
|
||||||
"""
|
"""
|
||||||
Parallel Virtual Cluster CLI management tool
|
Parallel Virtual Cluster CLI management tool
|
||||||
|
|
Loading…
Reference in New Issue