From da416af68645db4e2b0b54d9626488c07283252e Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Thu, 14 Feb 2019 02:02:10 +0100 Subject: [PATCH] added README --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..94ae7d6 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# 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: + +```rust +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](https://crates.io/crates/ctor). Be aware though it might not be suited for every use case, as explained on the crate’s 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"); +} +``` + +# Acknowledgements + +A big thank you to [nbouteme](https://github.com/nbouteme) who helped me a lot during the development of this create.