projects
/
evpf.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed coloured output to use colored instead of ansi_term
[evpf.git]
/
src
/
main.rs
diff --git
a/src/main.rs
b/src/main.rs
index
2154ba5
..
98532ff
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-1,8
+1,7
@@
use std::io;
use std::io::Write;
use regex::Regex;
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";
use std::env;
const ILLEGAL_EXP : &'static str = "Illegal Expression";
@@
-159,12
+158,12
@@
fn main() {
if res.is_ok () {
let restxt = format! ("{}: {}", RESULT,
res.unwrap());
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());
} else {
// print the error in purple
let errtxt = format! ("{}: {}", ERROR,
res.unwrap_err());
- eprintln! ("{}",
Colour::Purple.paint (errtxt
));
+ eprintln! ("{}",
errtxt.purple (
));
}
} else {
}
} else {
@@
-178,7
+177,7
@@
fn main() {
// loop until a blank line is received
loop {
expr.clear ();
// 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);
io::stdout().flush ().expect (ERR_FLUSHING);
// read a line of text
io::stdin().read_line (&mut expr).expect (ERR_READING_LINE);
@@
-191,7
+190,7
@@
fn main() {
} else if expr == "?" || expr == "h" || expr == "H" {
// display help text
for text in HELP_TEXT.iter() {
} 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;
}
continue;
@@
-207,13
+206,13
@@
fn main() {
if res.is_ok () {
let restxt = format! ("{}: {}", RESULT,
res.unwrap());
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());
} 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(
));
}
}
}
}
}
}