AlloyTools / org.alloytools.alloy

Alloy is a language for describing structures and a tool for exploring them. It has been used in a wide range of applications from finding holes in security mechanisms to designing telephone switching networks. This repository contains the code for the tool.
Other
694 stars 123 forks source link

Print the 0th table; label the repeat number #261

Closed awwaiid closed 2 months ago

awwaiid commented 2 months ago

The formatting for CLI exec with table output is a bit off, here is an improvement.

Before this change, the repeat-labels are weird and there are some newlines missing. But also the first repeat output doesn't have any instances:

$ java -jar org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar exec -c example -o -- -t table -r 2 simple.als
00. run   example              []                                                           0    ┌───┬──────┐
│sig│fields│
└───┴──────┘

1    ┌──────────┬──────────┐
│sig       │fields    │
├──────────┼──────────┤
│this/Thing│this/Thing│
│          ├──────────┤
│          │Thing¹    │
│          ├──────────┤
│          │Thing²    │
└──────────┴──────────┘

After:

$ java -jar org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar exec -c example -o -- -t table -r 2 simple.als
00. run   example              []
repeat 0
┌──────────┬──────────┐
│sig       │fields    │
├──────────┼──────────┤
│this/Thing│this/Thing│
│          ├──────────┤
│          │Thing²    │
└──────────┴──────────┘

repeat 1
┌──────────┬──────────┐
│sig       │fields    │
├──────────┼──────────┤
│this/Thing│this/Thing│
│          ├──────────┤
│          │Thing¹    │
│          ├──────────┤
│          │Thing²    │
└──────────┴──────────┘

With this change it'll also not print the repeat 0 when there is only the one.

pkriens commented 2 months ago

I've also updated this part. Please check. really appreciate the collaboration.