Go to file
Lucien Cartier-Tilet 060a3b7408
Custom Error type, as per clippy’s wishes
2022-02-12 23:10:59 +01:00
examples Added example 2019-02-14 14:09:18 +01:00
src Custom Error type, as per clippy’s wishes 2022-02-12 23:10:59 +01:00
.gitignore initial commit 2019-02-14 00:25:52 +01:00
.gitlab-ci.yml Added GitlabCI configuration 2019-02-14 14:12:36 +01:00
Cargo.toml New release for new license 2021-03-09 18:21:45 +01:00
LICENSE Change license to MIT 2019-02-21 10:50:03 +01:00
README.md Fix README incorrect license reference 2019-05-13 19:46:17 +02:00
appveyor.yml Fix for AppVeyor config 2019-02-14 13:27:12 +01:00

README.md

crates.io Released API docs Downloads MIT Licensed AppVeyor CI pipeline status

Output-VT100

This simple crates allows developers to enable ANSI escape characters in Windows' console, be it CMD or PowerShell. Its usage is very simple, as shown below:

extern crate output_vt100;

fn main() {
    output_vt100::init();
    println!("\x1b[31mThis text is red!\x1b[0m");
}

If you wish to ensure the output_vt100::init() function is only ran once, you can use the crate ctor. Be aware though it might not be suited for every use case, as explained on the crates presentation.

extern crate output_vt100;
extern crate ctor;
use ctor::*;

#[ctor]
fn init_term() {
    output_vt100::init();
}

fn main() {
    println!("\x1b[31mThis text is red!\x1b[0m");
}

Not that init panics on error, if you do not wish to panic, use output_vt100::try_init which returns a Result<(), ()>

Acknowledgements

A big thank you to nbouteme who helped me a lot during the development of this create.