small vala shared library managing tracing, display formatting and ansi-extended colors on stdout & stderror.
Go to file
2017-11-04 14:41:52 +01:00
build version 0.1.0 2017-11-04 14:41:52 +01:00
resources version 0.1.0 2017-11-04 14:41:52 +01:00
src version 0.1.0 2017-11-04 14:41:52 +01:00
.gitignore version 0.1.0 2017-11-04 14:41:52 +01:00
LICENSE version 0.1.0 2017-11-04 14:41:52 +01:00
main.vala version 0.1.0 2017-11-04 14:41:52 +01:00
meson.build version 0.1.0 2017-11-04 14:41:52 +01:00
pluie_echo.h version 0.1.0 2017-11-04 14:41:52 +01:00
README.md version 0.1.0 2017-11-04 14:41:52 +01:00

libpluie-echo

small vala shared library managing tracing, display formatting and ansi-extended colors on stdout & stderror.

Prerequisites

valac meson ninja glib gobject

Install

git clone the project then cd to project and do :

meson --prefix=/usr ./ build
sudo ninja install -C build

Compilation

valac --pkg pluie-echo-0.1  main.vala -o echo

Usage

playing with colors

using Pluie;

int main (string[] args)
{
    var c1 = new Color(37, false);
    var c2 = new Color(204, true);
    stdout.printf ("[%s][%s]", c1.s ("oki"), c2.s ("cool"));
    return 0;
}

init OutputFormatter

using GLib;
using Pluie;

int main (string[] args)
{
    OutputFormatter of;  
    Echo.init (true /* enable tracing */, "resources/echo.ini", out of);
    Dbg.in (Log.METHOD);
    
    of.echo (
        // multiline string
        "\nsample echo\non multiple\nline", 
        // newline
        true,
        // indent all line
        true,
        // set color with Pluie.ECHO enum listing all defined styles
        ECHO.ACTION
    );
    ...
    return 0;
}

more samples

Sample 1 code Sample 1 output Sample 2 code Sample 2 output

Configuration

configuration file is installed on {prefix}/share/pluie/echo.ini

[Term]
term_width = 105
indent     = 4
key_maxlen = 17

[Colors]
# keys are fixed. overwrite only values
# fg ansi extended color code (0..255), bold (0|1), bg ansi extended color code (0..255)
default    =
comment    = 103,1
option     =  37,1
option_sep = 158
arg        =  97,1
arg_sep    = 147,1
title      =  15,1,24
title_item = 220,1
title_sep  =  24,1
section    =  37
sep        =  59
item       = 215,1
action     =  97,1
done       =  15,1,36
fail       =  15,1,196
key        =  37,1
val        = 215,1
date       = 215,1
time       = 210,1
microtime  = 204,1
file       =  95,1
num        = 218,1
enter      =  36,1
leave      = 167,1
warn       = 220,1,89
error      =  15,1,196