mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-08 06:28:56 +01:00
Added some colours to the terminal output.
This commit is contained in:
parent
036fadb041
commit
2b90620d83
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -1,5 +1,14 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayref"
|
name = "arrayref"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
@ -113,6 +122,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
name = "lek"
|
name = "lek"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
"phf",
|
"phf",
|
||||||
"rustyline",
|
"rustyline",
|
||||||
]
|
]
|
||||||
|
@ -13,3 +13,4 @@ panic = "abort"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
rustyline = "6.1.2"
|
rustyline = "6.1.2"
|
||||||
phf = { version = "0.8", features = ["macros"] }
|
phf = { version = "0.8", features = ["macros"] }
|
||||||
|
ansi_term = "0.12"
|
||||||
|
@ -7,9 +7,10 @@ mod parser;
|
|||||||
mod prelude;
|
mod prelude;
|
||||||
mod symbol_table;
|
mod symbol_table;
|
||||||
|
|
||||||
|
use ansi_term::Colour::{Cyan, Red};
|
||||||
|
use ast::Unit;
|
||||||
use rustyline::error::ReadlineError;
|
use rustyline::error::ReadlineError;
|
||||||
use rustyline::Editor;
|
use rustyline::Editor;
|
||||||
use ast::Unit;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut parser = parser::Context::new();
|
let mut parser = parser::Context::new();
|
||||||
@ -24,7 +25,7 @@ fn main() {
|
|||||||
let mut rl = Editor::<()>::new();
|
let mut rl = Editor::<()>::new();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let readline = rl.readline(">> ");
|
let readline = rl.readline(&Cyan.paint(">> ").to_string());
|
||||||
|
|
||||||
match readline {
|
match readline {
|
||||||
Ok(input) => {
|
Ok(input) => {
|
||||||
@ -50,7 +51,7 @@ fn eval(parser: &mut parser::Context, input: &str) {
|
|||||||
match parser::parse(parser, input, get_angle_unit()) {
|
match parser::parse(parser, input, get_angle_unit()) {
|
||||||
Ok(Some(result)) => println!("{}", result),
|
Ok(Some(result)) => println!("{}", result),
|
||||||
Ok(None) => print!(""),
|
Ok(None) => print!(""),
|
||||||
Err(err) => println!("{}", err),
|
Err(err) => println!("{}", Red.paint(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user