mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
baa1c43d67
commit
061b3aa184
1 changed files with 10 additions and 2 deletions
|
|
@ -26,16 +26,24 @@ impl<'a> TryFrom<mlua::Table<'a>> for NotifyOpt {
|
|||
return Err("timeout must be non-negative".into_lua_err());
|
||||
}
|
||||
|
||||
let level = if let Ok(s) = t.raw_get::<_, mlua::String>("level") {
|
||||
s.to_str()?.parse().into_lua_err()?
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
title: t.raw_get("title")?,
|
||||
title: t.raw_get("title")?,
|
||||
content: t.raw_get("content")?,
|
||||
level: t.raw_get::<_, mlua::String>("level")?.to_str()?.parse().into_lua_err()?,
|
||||
level,
|
||||
timeout: Duration::from_secs_f64(timeout),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum NotifyLevel {
|
||||
#[default]
|
||||
Info,
|
||||
Warn,
|
||||
Error,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue