Skip to content

Commit

Permalink
Add debug flags to eval
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamRagstad committed Nov 7, 2024
1 parent 8b039c6 commit 2fb581e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ pub fn lento_args() -> Command {
.override_usage(format!("{} {}", "lt eval".bold(), "(options) [expr]".dim()))
.args([
arg!(<expr> "Sets the expression to evaluate"),
arg!(-d --debug "Turns on additional debugging information"),
arg!(-d --debug [level] "Turns on additional debugging information")
.value_parser(["trace", "debug", "info", "warn", "error"])
.default_missing_value("debug"),
])
)
.subcommand(
Expand Down
4 changes: 4 additions & 0 deletions src/commands/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use lento_core::{
use crate::error::{print_error, print_type_error};

pub fn handle_command_eval(args: &ArgMatches, _arg_parser: &mut Command) {
// Get the flag for REPL
if let Some(debug_level) = args.get_one::<String>("debug") {
init_logger_str(debug_level);
}
let expr = args.get_one::<String>("expr").unwrap().to_owned();
let mut parser = from_string(expr);
let mut checker = TypeChecker::default();
Expand Down

0 comments on commit 2fb581e

Please sign in to comment.