fix: less dependencies and simpler cli #6
cargo devel CI / cargo CI (push) Failing after 1m15s Details

This commit is contained in:
Christoph J. Scherr 2024-05-23 14:51:56 +02:00
parent f6c9c3c820
commit b9d0f82ccb
2 changed files with 8 additions and 17 deletions

View File

@ -12,8 +12,6 @@ repository = "https://git.cscherr.de/PlexSheep/hedu"
keywords = ["hexdumper"]
[dependencies]
libpt = { version = "0.5.1", features = ["log", "bintols"] }
libpt = { version = "0.5.1", features = ["bintols"], default-features = false }
clap = { version = "4.4.4", features = ["derive", "help"] }
clap-num = { version = "1.0.2" }
clap-verbosity-flag = { version = "2.0.1" }
anyhow = "1.0.79"

View File

@ -8,7 +8,6 @@ use std::{fs::File, io::IsTerminal, path::PathBuf};
use libpt::log::{error, trace, warn, Level, Logger};
use clap::Parser;
use clap_verbosity_flag::{InfoLevel, Verbosity};
mod dumper;
use dumper::{DataSource, Hedu};
@ -29,10 +28,9 @@ Author: {author-with-newline}
)]
/// Hexdumper written in Rust
pub struct Cli {
// clap_verbosity_flag seems to make this a global option implicitly
/// set a verbosity, multiple allowed (f.e. -vvv)
#[command(flatten)]
pub verbose: Verbosity<InfoLevel>,
/// show more details
#[arg(short, long)]
pub verbose: bool,
/// show additional logging meta data
#[arg(long)]
@ -119,15 +117,10 @@ fn main() {
fn cli_parse() -> Cli {
let cli = Cli::parse();
let ll: Level = match cli.verbose.log_level().unwrap().as_str() {
"TRACE" => Level::TRACE,
"DEBUG" => Level::DEBUG,
"INFO" => Level::INFO,
"WARN" => Level::WARN,
"ERROR" => Level::ERROR,
_ => {
unreachable!();
}
let ll: Level = if cli.verbose {
Level::INFO
} else {
Level::DEBUG
};
if cli.meta {
let _ = Logger::builder().max_level(ll).build();