]
[[package]]
-name = "ansi_term"
-version = "0.12.1"
+name = "atty"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
+ "hermit-abi",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "colored"
+version = "1.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
+dependencies = [
+ "atty",
+ "lazy_static",
"winapi",
]
name = "evpf"
version = "0.1.0"
dependencies = [
- "ansi_term",
+ "colored",
"regex",
]
+[[package]]
+name = "hermit-abi"
+version = "0.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+[[package]]
+name = "libc"
+version = "0.2.71"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
+
[[package]]
name = "memchr"
version = "2.3.3"
use std::io;
use std::io::Write;
use regex::Regex;
-use ansi_term::Colour;
-use ansi_term::Style;
+use colored::*;
use std::env;
const ILLEGAL_EXP : &'static str = "Illegal Expression";
if res.is_ok () {
let restxt = format! ("{}: {}", RESULT,
res.unwrap());
- println! ("{}", Colour::Green.paint (restxt));
+ println! ("{}", restxt.green ());
} else {
// print the error in purple
let errtxt = format! ("{}: {}", ERROR,
res.unwrap_err());
- eprintln! ("{}", Colour::Purple.paint (errtxt));
+ eprintln! ("{}", errtxt.purple ());
}
} else {
// loop until a blank line is received
loop {
expr.clear ();
- print!("{}", Style::new().bold().paint("evpf>"));
+ print!("{}", "evpf>".bold() );
io::stdout().flush ().expect (ERR_FLUSHING);
// read a line of text
io::stdin().read_line (&mut expr).expect (ERR_READING_LINE);
} else if expr == "?" || expr == "h" || expr == "H" {
// display help text
for text in HELP_TEXT.iter() {
- println! ("{}", Colour::Cyan.paint(*text));
+ println! ("{}", text.cyan() );
}
continue;
if res.is_ok () {
let restxt = format! ("{}: {}", RESULT,
res.unwrap());
- println! ("{}", Colour::Green.paint (restxt));
+ println! ("{}", restxt.green ());
} else {
// print the error in purple
let errtxt = format! ("{}: {}", ERROR,
res.unwrap_err());
- eprintln! ("{}", Colour::Purple.paint (errtxt));
- eprintln! ("{}", Colour::Purple.paint (ERROR_HELP));
+ eprintln! ("{}", errtxt.purple());
+ eprintln! ("{}", ERROR_HELP.purple());
}
}
}