feat(solver): add verbosity flag
cargo devel CI / cargo CI (push) Successful in 1m50s Details

This commit is contained in:
Christoph J. Scherr 2024-07-22 13:33:35 +02:00
parent 5f32f8227f
commit 44ed7210c4
2 changed files with 16 additions and 10 deletions

View File

@ -27,7 +27,7 @@ anyhow = "1.0.81"
chrono = { version = "0.4.37" }
clap = { version = "4.5.3", features = ["derive"], optional = true }
colored = { version = "2.1.0", optional = false }
libpt = "0.6.0"
libpt = { version = "0.6.0", features = ["cli"] }
num_cpus = "1.16.0"
rand = "0.8.5"
rayon = "1.10.0"

View File

@ -2,8 +2,13 @@
// #![warn(missing_docs)]
#![warn(missing_debug_implementations)]
use clap::Parser;
use clap::{Parser, Subcommand};
use libpt::cli::{
repl::{DefaultRepl, Repl},
strum,
};
use libpt::log::*;
use strum::IntoEnumIterator;
use wordle_analyzer::game::response::GuessResponse;
@ -25,8 +30,8 @@ struct Cli {
#[arg(short, long, default_value_t = wordle_analyzer::DEFAULT_MAX_STEPS)]
max_steps: usize,
/// more verbose logs
#[arg(short, long)]
verbose: bool,
#[command(flatten)]
verbose: libpt::cli::args::VerbosityLevel,
/// which solver to use
#[arg(short, long, default_value_t = BuiltinSolverNames::default())]
solver: BuiltinSolverNames,
@ -34,12 +39,13 @@ struct Cli {
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
if cli.verbose {
Logger::builder().set_level(Level::DEBUG).build().unwrap();
} else {
Logger::builder().set_level(Level::INFO).build().unwrap();
}
debug!("dumping CLI: {:#?}", cli);
Logger::builder()
.set_level(cli.verbose.level())
.build()
.unwrap();
trace!("dumping CLI: {:#?}", cli);
// let repl = libpt::cli::repl::DefaultRepl::<ReplCommand>::default();
let wl = BuiltinWList::default();
let builder = game::Game::builder(&wl)