changing to miette instead of color_eyre
This commit is contained in:
parent
45717708ba
commit
04a470d771
4 changed files with 215 additions and 121 deletions
|
@ -1,5 +1,5 @@
|
|||
use color_eyre::{eyre::eyre, Result};
|
||||
use env::Environment;
|
||||
use miette::{miette, IntoDiagnostic, Result};
|
||||
use printer::print;
|
||||
use reader::read;
|
||||
use rustyline::{config::Configurer, error::ReadlineError, Editor};
|
||||
|
@ -26,7 +26,7 @@ pub fn main() -> Result<()> {
|
|||
.iter()
|
||||
.map(|a| match a {
|
||||
Value::Number(a) => Ok(*a),
|
||||
_ => Err(eyre!("Should be a number")),
|
||||
_ => Err(miette!("Should be a number")),
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
|
@ -44,7 +44,7 @@ pub fn main() -> Result<()> {
|
|||
.iter()
|
||||
.map(|a| match a {
|
||||
Value::Number(a) => Ok(*a),
|
||||
_ => Err(eyre!("Should be a number")),
|
||||
_ => Err(miette!("Should be a number")),
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
|
@ -60,7 +60,7 @@ pub fn main() -> Result<()> {
|
|||
let entry = rl.readline(">> ");
|
||||
match entry {
|
||||
Ok(line) => {
|
||||
rl.add_history_entry(line.as_str())?;
|
||||
rl.add_history_entry(line.as_str()).into_diagnostic()?;
|
||||
match read_eval_print(line.as_str(), &mut env) {
|
||||
Ok(s) => println!("{s}"),
|
||||
Err(e) => eprintln!("{e}"),
|
||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -1,13 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use color_eyre::{
|
||||
eyre::{eyre, ContextCompat},
|
||||
Result,
|
||||
};
|
||||
use env::Environment;
|
||||
use miette::{miette, IntoDiagnostic, Result};
|
||||
use printer::print;
|
||||
use reader::read;
|
||||
use regex::Regex;
|
||||
use rustyline::{config::Configurer, error::ReadlineError, Editor};
|
||||
|
||||
pub mod env;
|
||||
|
@ -32,7 +26,7 @@ fn main() -> Result<()> {
|
|||
.iter()
|
||||
.map(|a| match a {
|
||||
Value::Number(a) => Ok(*a),
|
||||
_ => Err(eyre!("Should be a number")),
|
||||
_ => Err(miette!("Should be a number")),
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
|
@ -50,7 +44,7 @@ fn main() -> Result<()> {
|
|||
.iter()
|
||||
.map(|a| match a {
|
||||
Value::Number(a) => Ok(*a),
|
||||
_ => Err(eyre!("Should be a number")),
|
||||
_ => Err(miette!("Should be a number")),
|
||||
})
|
||||
.flatten()
|
||||
.collect();
|
||||
|
@ -66,7 +60,7 @@ fn main() -> Result<()> {
|
|||
let entry = rl.readline(">> ");
|
||||
match entry {
|
||||
Ok(line) => {
|
||||
rl.add_history_entry(line.as_str())?;
|
||||
rl.add_history_entry(line.as_str()).into_diagnostic()?;
|
||||
match read_eval_print(line.as_str(), &env) {
|
||||
Ok(s) => println!("{s}"),
|
||||
Err(e) => eprintln!("{e}"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue