rimilo 0.2.1

Jam Alia Vort{ar,il}o por trci rimvortojn.
mod argaro;
use structopt::StructOpt;

use regex::Regex;

static VORTAR: phf::OrderedMap<&'static str, &'static str> =
    include!(concat!(env!("OUT_DIR"), "/vortoj.rs"));

fn main() {
    let argar = argaro::Argar::from_args();

    let regeks_stringo = if argar.fina {
        r"(?P<unua>{}).$"
    } else if argar.plena {
        r"^(?P<unua>{}).$"
    } else {
        r"(?P<unua>{})"
    };

    let regekso = Regex::new(regeks_stringo).unwrap();

    if argar.angla {
        for (ŝlosilo, valuo) in &VORTAR {
            if regekso.is_match(valuo) {
                println!(
                    "{:<32}| {}",
                    ŝlosilo,
                    regekso.replace(valuo, "\u{1b}[1;31m${1}\u{1b}[0m"),
                );
            }
        }

    } else {
        for (ŝlosilo, valuo) in &VORTAR {
            if regekso.is_match(ŝlosilo) {
                println!(
                    "{:<32}| {}",
                    regekso.replace(ŝlosilo, "\u{1b}[1;31m${1}\u{1b}[0m"),
                    valuo
                );
            }
        }
    }
}