Skip to content

Commit 884bf6a

Browse files
authored
Show SDK version using sai-cli -h (#82)
1 parent 73cd5f9 commit 884bf6a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

python/cli/sai_cli.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@
88
from .diagnose.diagnose import define_subparser as diagnose_define_subparser
99

1010
def parse_args():
11-
parser = argparse.ArgumentParser(description='Spectacular AI command line tool')
11+
def get_sdk_version():
12+
from importlib.metadata import version, PackageNotFoundError
13+
try:
14+
return version("spectacularAI")
15+
except PackageNotFoundError:
16+
return None
17+
18+
version = get_sdk_version()
19+
if version:
20+
description = f"Spectacular AI command line tool ({version})"
21+
else:
22+
description = "Spectacular AI command line tool"
23+
24+
parser = argparse.ArgumentParser(description=description)
1225
subparsers = parser.add_subparsers(title='subcommands', dest='subcommand', required=True)
1326
process_define_subparser(subparsers)
1427
record_define_subparser(subparsers)

0 commit comments

Comments
 (0)