decorator 1.0.0

A small betterC compatible library for user-friendly messages.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Overview

Decorator is a simple library for adding comments onto lines of text, primarily aimed at user-friendly error messages.

The colouring abilities are powered by JANSI, a betterC compatible ANSI library.

For example:

image

The above output was generated from the following code:

import core.stdc.stdio;
DecoratorBC!(1, 1, 1, 3) d;

d.addLine("printf(\"%s\", 400)", "main.c", 5);
d.colourLine(0, 0, 6, AnsiStyleSet.init.fg(Ansi4BitColour.yellow));
d.colourLine(0, 7, 11, AnsiStyleSet.init.fg(Ansi4BitColour.magenta));
d.colourLine(0, 13, 16, AnsiStyleSet.init.fg(Ansi4BitColour.cyan));

d.addTopComment(0, 8, "%s was specified.");
d.colourTopComment(0, 0, 0, 3, AnsiStyleSet.init.fg(Ansi4BitColour.green));

d.addBotComment(0, 13, "But a %d value was passed");
d.colourBotComment(0, 0, 6, 8, AnsiStyleSet.init.fg(Ansi4BitColour.red));

d.toString((const(char)[] str){ printf("%.*s", cast(int)str.length, str.ptr); });
Authors:
  • Bradley
Dependencies:
jansi
Versions:
1.0.0 2021-Oct-31
~master 2021-Oct-31
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
0.4
Short URL:
decorator.dub.pm