armoha / euddraft

System for pluginizing eudplib codes.
Other
29 stars 4 forks source link

Improve error messages #55

Closed zuhanit closed 2 years ago

zuhanit commented 2 years ago

This changes RuntimeError messages to print looks like actual codes. See #54

examples:

  1. Duplicate Section

    image image
  2. Duplicate Key

image image
armoha commented 2 years ago

Using colorama as dependency would be simplest way to color terminal text: https://github.com/tartley/colorama

ANSI escape character sequences have long been used to produce colored terminal text and cursor positioning on Unix and Macs. Colorama makes this work on Windows, too, by wrapping stdout, stripping ANSI sequences it finds (which would appear as gobbledygook in the output), and converting them into the appropriate win32 calls to modify the state of the terminal. On other platforms, Colorama does nothing.

armoha commented 2 years ago

Sounds good to me, thanks for the PR!