diff options
Diffstat (limited to 'pyGHDL/cli')
-rwxr-xr-x | pyGHDL/cli/DOM.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pyGHDL/cli/DOM.py b/pyGHDL/cli/DOM.py index abf1f0af8..6bd6c8a7e 100755 --- a/pyGHDL/cli/DOM.py +++ b/pyGHDL/cli/DOM.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from sys import argv +from sys import exit as sysexit from pathlib import Path @@ -38,23 +39,25 @@ class Application: print("\n".join(buffer)) -def main(): - items = argv[1:] +def main(items): + _exitcode = 0 + if len(items) < 1: print("Please, provide the files to be analyzed as CLI arguments.") print("Using <testsuite/pyunit/SimpleEntity.vhdl> for demo purposes.\n") items = ["testsuite/pyunit/SimpleEntity.vhdl"] for item in items: - print("ยท", item) try: app = Application() app.addFile(Path(item), "default_lib") + app.prettyPrint() except GHDLBaseException as ex: print(ex) + _exitcode = 1 - app.prettyPrint() + return _exitcode if __name__ == "__main__": - main() + sysexit(main(argv[1:])) |