Fixes issues

Signed-off-by: alexis-opolka <53085471+alexis-opolka@users.noreply.github.com>
This commit is contained in:
alexis-opolka 2025-04-07 22:55:32 +02:00
parent 5989f4c677
commit 4ea5307c2d
5 changed files with 11 additions and 34 deletions

2
Cargo.lock generated
View File

@ -375,7 +375,7 @@ dependencies = [
[[package]]
name = "navi"
version = "2.24.0"
version = "2.25.0-beta1"
dependencies = [
"anyhow",
"clap",

View File

@ -1,6 +1,6 @@
[package]
name = "navi"
version = "2.24.0"
version = "2.25.0-beta1"
authors = ["Denis Isidoro <denis_isidoro@live.com>"]
edition = "2021"
description = "An interactive cheatsheet tool for the command-line"

View File

@ -196,3 +196,9 @@ impl Config {
}
}
}
impl Default for Config {
fn default() -> Self {
Self::new()
}
}

View File

@ -1,8 +1,4 @@
use crate::prelude::*;
use std::env;
use tracing_subscriber::EnvFilter;
static RUST_LOG: &str = "RUST_LOG";
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
@ -10,28 +6,3 @@ pub struct TracingConfig {
pub time: bool,
pub level: String,
}
pub fn init(config: Option<&TracingConfig>) {
if let Some(tracing) = config {
let level_is_set = match env::var(RUST_LOG) {
Err(_) => false,
Ok(v) => !v.is_empty(),
};
if !level_is_set {
env::set_var(RUST_LOG, &tracing.level);
}
let filter = EnvFilter::from_default_env();
let t = tracing_subscriber::fmt().with_env_filter(filter);
let res = if tracing.time {
t.try_init()
} else {
t.without_time().try_init()
};
if let Err(e) = res {
error!("unable to set tracing subscriber: {}", e);
}
}
}

View File

@ -225,10 +225,10 @@ impl<'a> Parser<'a> {
let write_fn = self.write_fn;
return self
self
.writer
.write_all(write_fn(item).as_bytes())
.context("Failed to write command to finder's stdin");
.context("Failed to write command to finder's stdin")
}
pub fn read_lines(
@ -345,7 +345,7 @@ mod tests {
let opts = command_options.unwrap();
assert_eq!(opts.header_lines, 0);
assert_eq!(opts.column, None);
assert_eq!(opts.delimiter, None);
assert_eq!(opts.delimiter, Some("\\s\\s".to_string()));
assert_eq!(opts.suggestion_type, SuggestionType::SingleSelection);
}
}