mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-25 17:51:10 +00:00
Re-implement no-longer-missing metadata fields
This commit is contained in:
parent
d7a2974494
commit
41aadaeab4
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -13,7 +13,7 @@ dependencies = [
|
||||
"number_prefix 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pad 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"users 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"users 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -40,7 +40,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -54,7 +54,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.2.9"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#315a6f2e6f20babaa2f48416de9a14d15420cf1b"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#42776b31a4b3755df95ec79e6bcaffcee83a93f1"
|
||||
dependencies = [
|
||||
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -70,12 +70,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.2.12"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#315a6f2e6f20babaa2f48416de9a14d15420cf1b"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#42776b31a4b3755df95ec79e6bcaffcee83a93f1"
|
||||
dependencies = [
|
||||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libssh2-sys 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libssh2-sys 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -89,12 +89,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libssh2-sys"
|
||||
version = "0.1.18"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -140,7 +140,7 @@ version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -161,10 +161,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libressl-pnacl-sys 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -214,7 +214,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustc-serialize"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -236,12 +236,12 @@ version = "0.2.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "users"
|
||||
version = "0.3.2"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -17,7 +17,7 @@ num_cpus = "*"
|
||||
number_prefix = "0.2.3"
|
||||
pad = "0.1.1"
|
||||
unicode-width = "*"
|
||||
users = "0.3.1"
|
||||
users = "0.4.0"
|
||||
|
||||
[features]
|
||||
default = [ "git" ]
|
||||
|
14
src/file.rs
14
src/file.rs
@ -3,7 +3,7 @@ use std::env::current_dir;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::os::unix;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::os::unix::fs::{MetadataExt, PermissionsExt};
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
|
||||
use ansi_term::{ANSIString, ANSIStrings, Colour, Style};
|
||||
@ -245,7 +245,7 @@ impl<'a> File<'a> {
|
||||
/// This file's number of hard links as a coloured string.
|
||||
fn hard_links(&self, locale: &locale::Numeric) -> Cell {
|
||||
let style = if self.has_multiple_links() { Red.on(Yellow) } else { Red.normal() };
|
||||
Cell::paint(style, &locale.format_int(0 /*self.stat.unstable.nlink*/ as isize)[..])
|
||||
Cell::paint(style, &locale.format_int(self.stat.as_raw().nlink())[..])
|
||||
}
|
||||
|
||||
/// Whether this is a regular file with more than one link.
|
||||
@ -254,19 +254,19 @@ impl<'a> File<'a> {
|
||||
/// while you can come across directories and other types with multiple
|
||||
/// links much more often.
|
||||
fn has_multiple_links(&self) -> bool {
|
||||
self.is_file() && (0 /*self.stat.unstable.nlink*/) > 1
|
||||
self.is_file() && self.stat.as_raw().nlink() > 1
|
||||
}
|
||||
|
||||
/// This file's inode as a coloured string.
|
||||
fn inode(&self) -> Cell {
|
||||
let inode = 0i32; /* self.stat.unstable.inode */
|
||||
let inode = self.stat.as_raw().ino();
|
||||
Cell::paint(Purple.normal(), &inode.to_string()[..])
|
||||
}
|
||||
|
||||
/// This file's number of filesystem blocks (if available) as a coloured string.
|
||||
fn blocks(&self, locale: &locale::Numeric) -> Cell {
|
||||
if self.is_file() || self.is_link() {
|
||||
Cell::paint(Cyan.normal(), &locale.format_int(0 /*self.stat.unstable.blocks*/)[..])
|
||||
Cell::paint(Cyan.normal(), &locale.format_int(self.stat.as_raw().blocks())[..])
|
||||
}
|
||||
else {
|
||||
Cell { text: GREY.paint("-").to_string(), length: 1 }
|
||||
@ -279,7 +279,7 @@ impl<'a> File<'a> {
|
||||
/// instead. This usually happens when a user is deleted, but still owns
|
||||
/// files.
|
||||
fn user<U: Users>(&self, users_cache: &mut U) -> Cell {
|
||||
let uid = 0; // self.stat.unstable.uid as u32
|
||||
let uid = self.stat.as_raw().uid();
|
||||
|
||||
let user_name = match users_cache.get_user_by_uid(uid) {
|
||||
Some(user) => user.name,
|
||||
@ -294,7 +294,7 @@ impl<'a> File<'a> {
|
||||
///
|
||||
/// As above, if not present, it formats the gid as a number instead.
|
||||
fn group<U: Users>(&self, users_cache: &mut U) -> Cell {
|
||||
let gid = 0; // self.stat.unstable.gid as u32;
|
||||
let gid = self.stat.as_raw().gid();
|
||||
let mut style = Plain;
|
||||
|
||||
let group_name = match users_cache.get_group_by_gid(gid as u32) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(collections, convert, core, exit_status, fs_ext, fs_mode, fs_time, io, libc, os, scoped, std_misc)]
|
||||
#![feature(collections, convert, core, exit_status, fs_ext, fs_mode, fs_time, io, libc, metadata_ext, os, scoped, std_misc)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
// Other platforms than macos don't need std_misc but you can't
|
||||
|
Loading…
Reference in New Issue
Block a user