Skip to content

Commit

Permalink
Added basic argument handling, needs to be updated with proper arg ha…
Browse files Browse the repository at this point in the history
…ndling and help text
  • Loading branch information
hyakuhei committed Dec 29, 2021
1 parent 3d24ba5 commit 6c1ea54
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
26 changes: 22 additions & 4 deletions src/jtg.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def genGraph(doc, sceneName, compoundLinks=False, linkCounters=True, printLabels

linkCounter += 1

flowLabel = "WAA"
flowLabel = ""
if linkCounters == True:
flowLabel = f"{linkCounter}."

Expand Down Expand Up @@ -109,7 +109,7 @@ def prepDoc(doc):
path = search(doc["boundaries"], actor)
return doc

def main(generateArchDiagram=True, markdown=False, printLabels=False):
def main(generateArchDiagram=True, markdown=False, printLabels=False, linkCounters=True):
doc = json.loads(sys.stdin.read())
doc = prepDoc(doc)
graph = None
Expand All @@ -120,7 +120,7 @@ def main(generateArchDiagram=True, markdown=False, printLabels=False):

for scene in doc["scenes"]:
for sceneName in scene.keys():
graph = genGraph(doc, sceneName, printLabels=printLabels)
graph = genGraph(doc, sceneName, linkCounters=linkCounters, printLabels=printLabels)

fileName = f"output/{sceneName}"
with open(f"{fileName}.dot", "w") as f:
Expand All @@ -147,4 +147,22 @@ def main(generateArchDiagram=True, markdown=False, printLabels=False):

if __name__ == "__main__":
#TODO argument handling
main(generateArchDiagram=True, markdown=True, printLabels=False)

parms = {
'generateArchDiagram':False,
'markdown':False,
'printLabels':False,
'linkCounters':False

}

if "-arch" in sys.argv:
parms['generateArchDiagram'] = True
if "-markdown" in sys.argv:
parms['markdown'] = True
if "-label" in sys.argv:
parms["printLabels"] = True
if "-number" in sys.argv:
parms["linkCounters"] = True

main(**parms)
13 changes: 12 additions & 1 deletion src/ltm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@
STRING: ESCAPED_STRING
%import common.WORD
//
// Names (Variables)
//
LCASE_LETTER: "a".."z"
UCASE_LETTER: "A".."Z"
DELIM_CHAR: ("/"|"-"|"_")
LETTER: UCASE_LETTER | LCASE_LETTER | DELIM_CHAR | DIGIT
WORD: LETTER+
%import common.DIGIT
%import common.ESCAPED_STRING
%import common.WS
Expand Down

0 comments on commit 6c1ea54

Please sign in to comment.