summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 68bc665..77d9ec5 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1,4 +1,3 @@
-use crate::{config::Paths, Config, Result};
use clap::{Args, Parser};
use std::path::PathBuf;
use tracing_subscriber::{filter::LevelFilter, Layer, Registry};
@@ -27,28 +26,21 @@ pub struct Cli {
}
impl Cli {
- pub fn as_layer(&self) -> Result<Vec<Box<dyn Layer<Registry> + Send + Sync>>> {
- let mut layers = Vec::new();
-
+ pub fn as_layer(&self) -> Vec<Box<dyn Layer<Registry> + Send + Sync>> {
let fmt_layer = tracing_subscriber::fmt::layer()
.pretty()
- .with_filter(self.verbose.into_filter())
+ .with_filter(self.verbose.as_filter())
.boxed();
- layers.push(fmt_layer);
-
- Ok(layers)
+ vec![fmt_layer]
}
- pub fn as_config(&self) -> Config {
- Config {
- paths: Paths {
- search: self.path.to_owned(),
- add: self.directory.to_owned(),
- hidden: self.hidden,
- },
- finder: Default::default(),
- logging: Default::default(),
+ // TODO: replace this with `impl Figment for Cli`
+ pub fn as_config(&self) -> crate::directories::Config {
+ crate::directories::Config {
+ search: self.path.to_owned(),
+ add: self.directory.to_owned(),
+ hidden: self.hidden,
}
}
}
@@ -65,7 +57,7 @@ pub struct Verbosity {
}
impl Verbosity {
- pub fn into_filter(&self) -> LevelFilter {
+ pub fn as_filter(&self) -> LevelFilter {
self.into()
}
}