mirror of
https://github.com/sxyazi/yazi.git
synced 2024-07-14 21:50:39 +03:00
..
This commit is contained in:
parent
e02c9169fc
commit
a7722f5f9d
@ -22,13 +22,8 @@ function Folder:linemode(area, files)
|
||||
elseif mode == "permissions" then
|
||||
spans[#spans + 1] = ui.Span(f.cha:permissions() or "")
|
||||
elseif mode == "owner" then
|
||||
if f.cha.uid and f.cha.gid then
|
||||
local user = ya.user_name(f.cha.uid)
|
||||
local group = ya.group_name(f.cha.gid)
|
||||
if user and group then
|
||||
spans[#spans + 1] = ui.Span(user .. ":" .. group)
|
||||
end
|
||||
end
|
||||
spans[#spans + 1] = ya.user_name and ui.Span(ya.user_name(f.cha.uid) .. ":" .. ya.group_name(f.cha.gid))
|
||||
or ui.Span("")
|
||||
end
|
||||
|
||||
spans[#spans + 1] = ui.Span(" ")
|
||||
|
@ -1,7 +1,5 @@
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
#[cfg(windows)]
|
||||
use mlua::Value::Nil;
|
||||
use mlua::{AnyUserData, ExternalError, Lua, Table, UserDataFields, UserDataMethods, UserDataRef};
|
||||
use yazi_shared::fs::ChaKind;
|
||||
|
||||
@ -25,20 +23,10 @@ impl Cha {
|
||||
reg.add_field_method_get("is_exec", |_, me| Ok(me.is_exec()));
|
||||
reg.add_field_method_get("is_sticky", |_, me| Ok(me.is_sticky()));
|
||||
|
||||
#[allow(unused_variables)]
|
||||
#[cfg(unix)]
|
||||
{
|
||||
reg.add_field_method_get("uid", |_, me| {
|
||||
#[cfg(unix)]
|
||||
return Ok(me.uid);
|
||||
#[cfg(windows)]
|
||||
return Ok(Nil);
|
||||
});
|
||||
reg.add_field_method_get("gid", |_, me| {
|
||||
#[cfg(unix)]
|
||||
return Ok(me.gid);
|
||||
#[cfg(windows)]
|
||||
return Ok(Nil);
|
||||
});
|
||||
reg.add_field_method_get("uid", |_, me| Ok(me.uid));
|
||||
reg.add_field_method_get("gid", |_, me| Ok(me.gid));
|
||||
}
|
||||
|
||||
reg.add_field_method_get("length", |_, me| Ok(me.len));
|
||||
@ -51,7 +39,6 @@ impl Cha {
|
||||
reg.add_field_method_get("accessed", |_, me| {
|
||||
Ok(me.accessed.and_then(|t| t.duration_since(UNIX_EPOCH).map(|d| d.as_secs_f64()).ok()))
|
||||
});
|
||||
#[allow(unused_variables)]
|
||||
reg.add_method("permissions", |_, me, ()| {
|
||||
Ok(
|
||||
#[cfg(unix)]
|
||||
|
Loading…
Reference in New Issue
Block a user