Simplify cli option, add channel search

This commit is contained in:
Dominik Werder
2021-05-27 16:23:38 +02:00
parent e55751ad67
commit 53957a261a
9 changed files with 155 additions and 22 deletions

View File

@@ -367,7 +367,7 @@ where
fn new(file: File) -> Self {
Self {
// TODO make buffer size a parameter:
buf: vec![0; 4096],
buf: vec![0; 1024 * 32],
all: vec![],
file: Some(file),
_marker: std::marker::PhantomData::default(),

View File

@@ -60,6 +60,19 @@ impl CacheUsage {
})?;
Ok(ret)
}
pub fn from_string(s: &str) -> Result<Self, Error> {
let ret = if s == "ignore" {
CacheUsage::Ignore
} else if s == "recreate" {
CacheUsage::Recreate
} else if s == "use" {
CacheUsage::Use
} else {
return Err(Error::with_msg(format!("can not interpret cache usage string: {}", s)));
};
Ok(ret)
}
}
impl Display for CacheUsage {