diff options
author | umarcor <unai.martinezcorral@ehu.eus> | 2021-06-18 02:27:18 +0200 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-06-18 05:10:53 +0200 |
commit | 7d5c6c488272d46bcd82b52f08d30554164bec9e (patch) | |
tree | 73d29e9bce7cd24ef15c76c4e77fb2db55344fe4 /pyGHDL | |
parent | 36e34666c3b3817a5422d116a27f37f80de1cba0 (diff) | |
download | ghdl-7d5c6c488272d46bcd82b52f08d30554164bec9e.tar.gz ghdl-7d5c6c488272d46bcd82b52f08d30554164bec9e.tar.bz2 ghdl-7d5c6c488272d46bcd82b52f08d30554164bec9e.zip |
pyGHDL/cli/DOM: support passing target files as CLI arguments
Diffstat (limited to 'pyGHDL')
-rw-r--r-- | pyGHDL/cli/DOM.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/pyGHDL/cli/DOM.py b/pyGHDL/cli/DOM.py index b8e6a134e..abf1f0af8 100644 --- a/pyGHDL/cli/DOM.py +++ b/pyGHDL/cli/DOM.py @@ -1,3 +1,7 @@ +#!/usr/bin/env python3 + +from sys import argv + from pathlib import Path from pydecor import export @@ -35,13 +39,21 @@ class Application: def main(): - try: - app = Application() - app.addFile(Path("testsuite/pyunit/SimpleEntity.vhdl"), "default_lib") - except GHDLBaseException as ex: - print(ex) - - app.prettyPrint() + items = argv[1:] + 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") + except GHDLBaseException as ex: + print(ex) + + app.prettyPrint() if __name__ == "__main__": |