mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Add entry count to directories
This commit is contained in:
parent
907ac09e34
commit
f2f5e4c814
1 changed files with 8 additions and 0 deletions
|
|
@ -42,6 +42,14 @@ impl File {
|
||||||
IconCache::Icon(cached) => Some(Icon::cast(lua, cached)).transpose(),
|
IconCache::Icon(cached) => Some(Icon::cast(lua, cached)).transpose(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reg.add_method("count", |_, me, ()| {
|
||||||
|
if me.as_ref().cha.is_dir() {
|
||||||
|
return Ok(Some(std::fs::read_dir::<&std::path::Path>(me.as_ref().url.as_ref())?.count()));
|
||||||
|
} else {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn install(lua: &Lua) -> mlua::Result<()> {
|
pub fn install(lua: &Lua) -> mlua::Result<()> {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue