sel-rs 0.2.2

Select slices from text files by line numbers, ranges, positions, or regex
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Minimal ANSI escape helpers — replaces the termcolor crate.

pub const GREEN: &str = "\x1b[32m";
pub const INVERSE: &str = "\x1b[7m";
pub const RESET: &str = "\x1b[0m";

/// Wrap `text` in `code` … RESET if `enabled`, otherwise pass through.
pub fn paint(enabled: bool, code: &str, text: &str) -> String {
    if enabled {
        format!("{code}{text}{RESET}")
    } else {
        text.to_string()
    }
}