mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
feat: add nlink property to the Cha plugin API (#1279)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
parent
9d0ef9a5dc
commit
afa5936bf5
3 changed files with 16 additions and 6 deletions
|
|
@ -1 +1 @@
|
|||
{"language":"en","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","imagesize","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE"],"version":"0.2"}
|
||||
{"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","imagesize","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","nlink"],"language":"en","version":"0.2","flagWords":[]}
|
||||
|
|
@ -27,6 +27,7 @@ impl Cha {
|
|||
{
|
||||
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("nlink", |_, me| Ok(me.nlink));
|
||||
}
|
||||
|
||||
reg.add_field_method_get("length", |_, me| Ok(me.len));
|
||||
|
|
@ -80,6 +81,8 @@ impl Cha {
|
|||
uid: t.raw_get("uid").unwrap_or_default(),
|
||||
#[cfg(unix)]
|
||||
gid: t.raw_get("gid").unwrap_or_default(),
|
||||
#[cfg(unix)]
|
||||
nlink: t.raw_get("nlink").unwrap_or_default(),
|
||||
})
|
||||
})?,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ pub struct Cha {
|
|||
#[cfg(unix)]
|
||||
pub permissions: libc::mode_t,
|
||||
#[cfg(unix)]
|
||||
pub uid: u32,
|
||||
pub uid: libc::uid_t,
|
||||
#[cfg(unix)]
|
||||
pub gid: u32,
|
||||
pub gid: libc::gid_t,
|
||||
#[cfg(unix)]
|
||||
pub nlink: libc::nlink_t,
|
||||
}
|
||||
|
||||
impl From<Metadata> for Cha {
|
||||
|
|
@ -67,17 +69,22 @@ impl From<Metadata> for Cha {
|
|||
#[cfg(unix)]
|
||||
permissions: {
|
||||
use std::os::unix::prelude::PermissionsExt;
|
||||
m.permissions().mode() as libc::mode_t
|
||||
m.permissions().mode() as _
|
||||
},
|
||||
#[cfg(unix)]
|
||||
uid: {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
m.uid()
|
||||
m.uid() as _
|
||||
},
|
||||
#[cfg(unix)]
|
||||
gid: {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
m.gid()
|
||||
m.gid() as _
|
||||
},
|
||||
#[cfg(unix)]
|
||||
nlink: {
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
m.nlink() as _
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue