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