From 4e44f7ac90bb60558bb19de4d5c9385065d0e228 Mon Sep 17 00:00:00 2001 From: Fischer Moseley <42497969+fischermoseley@users.noreply.github.com> Date: Thu, 11 Jan 2024 10:40:12 -0800 Subject: [PATCH] add version command to CLI --- src/manta/cli.py | 58 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/src/manta/cli.py b/src/manta/cli.py index 961aa0d..21d9519 100644 --- a/src/manta/cli.py +++ b/src/manta/cli.py @@ -3,22 +3,59 @@ from warnings import warn from sys import argv from pkg_resources import get_distribution -version = "v" + get_distribution("manta").version logo = f""" -Manta {version} + . + .'; + ( ( + . `. `. + `.. .' ) + ; `; .'.--. + :' `.' (' + .;' : + ______:..._____ ./' + .-" "-.( +(`-.__ .-' .. .. `-. __......') + `: `-... .-' :* : :* : `-. ...-' :' + `-. `\"""' `--' `--' `""\"' .-' + `-. . .-. .--. `. .-' + `-. : .'. ( `--_____--' ) `. ; .-' + `--..`.`.` `--... ..--' .'.'.' ..--' + `---... ````''' ...---' + `------........------' -Usage: - gen [config_file] [verilog_file] Generate a verilog file specifying the Manta module from a given configuration file, and save to the provided path - capture [config_file] [la_core_name] [vcd_file] [verilog_file] Start a capture on the specified core, and save the results to a .vcd or .v file at the provided path(s) - ports List all available serial ports - help Display this help menu + +\033[34;49;1m\033[34;49;3m Manta Version {get_distribution("manta").version} \033[00m +\033[34;49;1m\033[34;49;3m An In-Situ Debugging Tool for Programmable Hardware \033[00m +\033[34;49;1m\033[34;49;3m https://github.com/fischermoseley/manta \033[00m """ -def help(): - print(logo) +usage = """ +Usage: + gen [config_file] [verilog_file] + Generate a verilog file specifying the Manta module from a given + configuration file, and save to the provided path. + capture [config_file] [la_core_name] [vcd_file] [verilog_file] + Start a capture on the specified core, and save the results to a .vcd + or .v file at the provided path(s). + + ports + List all available serial ports. + + help + Display this help menu. + + version + Display the currently installed version.""" + + +def help(): + print(usage) + +def version(): + print(logo) def wrong_args(): print('Wrong number of arguments, run "manta help" for usage.') @@ -108,6 +145,9 @@ def main(): elif argv[1] == "ports": ports() + elif argv[1] == "version": + version() + else: wrong_args()