mirror of
https://github.com/uutils/coreutils
synced 2024-12-15 15:52:42 +00:00
ls,stat: Show more info in long format
This commit is contained in:
parent
0f98bd01e1
commit
86738ce6cf
1 changed files with 17 additions and 3 deletions
|
@ -401,12 +401,26 @@ pub fn canonicalize<P: AsRef<Path>>(
|
|||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
#[allow(unused_variables)]
|
||||
pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String {
|
||||
let write = if metadata.permissions().readonly() {
|
||||
'-'
|
||||
} else {
|
||||
'w'
|
||||
};
|
||||
|
||||
if display_file_type {
|
||||
return String::from("----------");
|
||||
let file_type = if metadata.is_symlink() {
|
||||
'l'
|
||||
} else if metadata.is_dir() {
|
||||
'd'
|
||||
} else {
|
||||
'-'
|
||||
};
|
||||
|
||||
format!("{0}r{1}xr{1}xr{1}x", file_type, write)
|
||||
} else {
|
||||
format!("r{0}xr{0}xr{0}x", write)
|
||||
}
|
||||
String::from("---------")
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
|
|
Loading…
Reference in a new issue