aisling 0.2.0

Embeddable terminal text effects and loaders for Rust TUI applications.
Documentation
use std::env;
use std::io::{self, Write};
use std::str::FromStr;
use std::thread;
use std::time::Duration;

use aisling::{Effect, EffectConfig, EffectKind};

fn main() {
    let mut args = env::args().skip(1);
    let effect = args.next().unwrap_or_else(|| "wipe".to_string());
    let text = args.next().unwrap_or_else(|| "Aisling".to_string());
    let kind = EffectKind::from_str(&effect).unwrap_or(EffectKind::Wipe);
    let config = EffectConfig::default().with_duration(90).with_seed(7);
    let effect = Effect::with_config(kind, text, config);

    let mut stdout = io::stdout();
    for frame in effect.iter() {
        write!(stdout, "\x1b[2J\x1b[H{}", frame.to_ansi_string()).unwrap();
        stdout.flush().unwrap();
        thread::sleep(Duration::from_millis(16));
    }
    writeln!(stdout).unwrap();
}