Rich Output
arc has a few utility elements for outputting rich content
Box¶
Highligh some output by surrounding it with a border
examples/box.py
import arc
from arc.color import fg
from arc.present import Box
@arc.command()
def command():
arc.print(Box("Some cool text", padding=2, color=fg.GREEN))
command()
Table¶
Display formatted tabular data
examples/table.py
import arc
from arc.present import Table
@arc.command
def command():
t = Table(["Name", "Age", "Stand"])
t.add_row(["Jonathen Joestar", 20, "-"])
t.add_row(["Joseph Joestar", 18, "Hermit Purple (in Part 3)"])
t.add_row(["Jotaro Kujo", 18, "Star Platinum"])
t.add_row(["Josuke Higashikata", 16, "Crazy Diamond"])
t.add_row(["Giorno Giovanna", 15, "Gold Experience"])
t.add_row(["Joylene Kujo", 19, "Stone Free"])
arc.print(t)
command()
$ python table.py
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name ┃ Age ┃ Stand ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Jonathen Joestar │ 20 │ - │
│ Joseph Joestar │ 18 │ Hermit Purple (in Part 3) │
│ Jotaro Kujo │ 18 │ Star Platinum │
│ Josuke Higashikata │ 16 │ Crazy Diamond │
│ Giorno Giovanna │ 15 │ Gold Experience │
│ Joylene Kujo │ 19 │ Stone Free │
└────────────────────┴─────┴───────────────────────────┘