seq_here/
error.rs

1use colored::Colorize;
2
3/// Error
4///
5
6/// `eprintln` the error,
7/// and then exit program with given code.
8///
9pub fn e_exit(e_type: &str, e_msg: &str, code: i32) -> ! {
10    e_println(e_type, e_msg);
11    std::process::exit(code);
12}
13
14/// `eprintln` the error,
15///
16pub fn e_println(e_type: &str, e_msg: &str) {
17    eprintln!("{}", e_msg);
18    eprintln!("{}<{}>: {}",
19              "Error".red().bold(),
20              e_type.yellow(),
21              e_msg
22    );
23}
24
25pub fn ok_println(tip: &str, msg: &str) {
26    println!("{}<{}>: {}",
27        "OK".green().bold(),
28        tip.yellow(),
29        msg
30    );
31}