Simplify cli option, add channel search
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user