Skip to content

Bring no-colour option to code snippet printer

Motivation and Context

Ligo compiler error messages return ANSI codes (for colors and bold output) that tools are not able to parse. Thus the need for an option enabling raw output, without ANSI codes.

Description

This MR introduces a new CLI option called --no-colour that is passed to the formatters to disable ANSI printing.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Before

$ ligo1 compile contract '~/ligo/src/test/contracts/warning_duplicate2.mligo'
File "~/ligo/src/test/contracts/warning_duplicate2.mligo", line 2, characters 14-16:
  1 |
  2 | let x : nat = [0;31;1m42[0m
  3 |

Invalid type(s).
Expected "nat", but got: "int".

After

$ ligo1 compile contract '~/ligo/src/test/contracts/warning_duplicate2.mligo' --no-colour
File "~/ligo/src/test/contracts/warning_duplicate2.mligo", line 2, characters 14-16:
  1 |
  2 | let x : nat = 42
  3 |

Invalid type(s).
Expected "nat", but got: "int".

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Nicolas Phan

Merge request reports

Loading