mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-18 14:21:32 +03:00
feat: add mime()
method to the file api
This commit is contained in:
parent
29e313640b
commit
0b0901823d
@ -60,6 +60,12 @@ impl Files {
|
||||
Ok(shared::permissions(me.meta().permissions()))
|
||||
});
|
||||
|
||||
reg.add_function("mime", |_, me: AnyUserData| {
|
||||
let manager = me.named_user_value::<UserDataRef<core::manager::Manager>>("manager")?;
|
||||
let file = me.borrow::<core::files::File>()?;
|
||||
Ok(manager.mimetype.get(file.url()).cloned())
|
||||
});
|
||||
|
||||
reg.add_function("prefix", |_, me: AnyUserData| {
|
||||
let folder = me.named_user_value::<UserDataRef<core::manager::Folder>>("folder")?;
|
||||
if !folder.cwd.is_search() {
|
||||
|
Loading…
Reference in New Issue
Block a user