1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
//! # ANSI Escape Sequence //! //! The `anes` crate provides ANSI escape sequences you can use to control the terminal //! cursor (show, hide, ...), colors (foreground, background), display attributes (bold, ...) //! and many others. //! //! Every sequence implements the standard library [`Display`](https://doc.rust-lang.org/std/fmt/trait.Display.html) //! trait. It means that these sequences can be used in macros like //! [`format!`](https://doc.rust-lang.org/std/macro.format.html) or //! [`write!`](https://doc.rust-lang.org/std/macro.write.html). //! //! Ask if you need more sequences or use the [`sequence!`](macro.sequence.html) macro to create //! your own sequences. //! //! ## Terminal Support //! //! Not all ANSI escape sequences are supported by all terminals. You can use the //! [interactive-test](https://github.com/zrzka/anes-rs/tree/master/interactive-test) to test them. //! //! ## Examples //! //! Retrieve the sequence as a `String`: //! //! ```rust //! use anes::SaveCursorPosition; //! //! let string = format!("{}", SaveCursorPosition); //! assert_eq!(&string, "\x1B7"); //! ``` //! //! Use the sequence on the standard output: //! //! ```rust //! use std::io::{Result, Write}; //! //! fn main() -> Result<()> { //! let mut stdout = std::io::stdout(); //! write!(stdout, "{}", anes::ResetAttributes)?; //! stdout.flush()?; //! Ok(()) //! } //! ``` #![warn(rust_2018_idioms)] #![deny(unused_imports, unused_must_use)] pub use self::{ attribute::{Attribute, ResetAttributes, SetAttribute}, buffer::{ ClearBuffer, ClearLine, ScrollBufferDown, ScrollBufferUp, SwitchBufferToAlternate, SwitchBufferToNormal, }, color::{Color, SetBackgroundColor, SetForegroundColor}, cursor::{ DisableCursorBlinking, EnableCursorBlinking, HideCursor, MoveCursorDown, MoveCursorLeft, MoveCursorRight, MoveCursorTo, MoveCursorToColumn, MoveCursorToNextLine, MoveCursorToPreviousLine, MoveCursorUp, RestoreCursorPosition, SaveCursorPosition, ShowCursor, }, terminal::ResizeTextArea, }; // Keep it first to load all the macros before other modules. #[macro_use] mod macros; mod attribute; mod buffer; mod color; mod cursor; mod terminal;