mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
20 lines
449 B
Rust
20 lines
449 B
Rust
use mlua::UserDataMethods;
|
|
use yazi_fs::file::FileInventory;
|
|
|
|
use crate::THEME;
|
|
|
|
inventory::submit! {
|
|
FileInventory {
|
|
register: |registry| {
|
|
registry.add_method("icon", |lua, me, ()| {
|
|
yazi_binding::deprecate!(
|
|
lua,
|
|
"{}: `File:icon()` is deprecated, use `th.icon:match(file)` instead"
|
|
);
|
|
// TODO: use a cache
|
|
Ok(THEME.icon.matches(me, false))
|
|
});
|
|
},
|
|
borrow: |_, _| Err(mlua::Error::UserDataTypeMismatch),
|
|
}
|
|
}
|