From 904a069517b8a74f5dd96516ffef3d4f49d36667 Mon Sep 17 00:00:00 2001 From: Pablo de la Concepcion Date: Sun, 21 Oct 2018 13:56:09 +0200 Subject: [PATCH 1/7] Added Rationale section to README.md (fixes #403) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 72959293..0a3c147d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ [exa](https://the.exa.website/) is a replacement for `ls` written in Rust. +## Rationale + +**exa** is a modern replacement for the command-line program ls that ships with Unix and Linux operating systems, is a modern file lister with more features and better defaults. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s **small**, **fast**, and just one **single binary**. + +By deliberately making some decisions differently, exa attempts to be a more featureful, more user-friendly version of ls. + ## Screenshots ![Screenshots of exa](screenshots.png) From 4e294b036394b901e528de6fd6acba403683df6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lanie=20Chauvel=20=28ariasuni=29?= Date: Wed, 24 Oct 2018 12:29:00 +0200 Subject: [PATCH 2/7] Applied suggested feedback Co-Authored-By: pconcepcion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a3c147d..6e01e61c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Rationale -**exa** is a modern replacement for the command-line program ls that ships with Unix and Linux operating systems, is a modern file lister with more features and better defaults. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s **small**, **fast**, and just one **single binary**. +**exa** is a modern replacement for the command-line program ls that ships with Unix and Linux operating systems, with more features and better defaults. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s **small**, **fast**, and just one **single binary**. By deliberately making some decisions differently, exa attempts to be a more featureful, more user-friendly version of ls. From d63917af47c08259b4c4a5f55730a88784ba6746 Mon Sep 17 00:00:00 2001 From: teresy Date: Tue, 6 Nov 2018 17:43:01 -0500 Subject: [PATCH 3/7] refactor: use shorthand fields --- src/fs/feature/xattr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fs/feature/xattr.rs b/src/fs/feature/xattr.rs index 93bab1df..b42b05e3 100644 --- a/src/fs/feature/xattr.rs +++ b/src/fs/feature/xattr.rs @@ -131,7 +131,7 @@ mod lister { FollowSymlinks::No => 0x0000, }; - Lister { c_flags: c_flags } + Lister { c_flags } } pub fn translate_attribute_name(&self, input: &[u8]) -> String { From e2d21ab9c1bbc1ddd264f7aaf20ac575998545a8 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Nov 2018 14:27:05 +0100 Subject: [PATCH 4/7] Exclude unneded files from crates.io --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 9611b205..2a5020ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ readme = "README.md" categories = ["command-line-utilities"] keywords = ["ls", "files", "command-line"] license = "MIT" +exclude = ["/devtools/*", "/Makefile", "/Vagrantfile", "/screenshots.png"] [[bin]] From 80b0d9dd0d2e929175d2c8d24e0bf6c67e0d9df1 Mon Sep 17 00:00:00 2001 From: ariasuni Date: Tue, 20 Nov 2018 18:12:38 +0100 Subject: [PATCH 5/7] Display if a file is ignored by git --- README.md | 2 +- src/fs/feature/git.rs | 1 + src/fs/fields.rs | 3 +++ src/options/help.rs | 2 +- src/output/render/git.rs | 3 +++ src/style/colours.rs | 4 +++- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f4596e19..ad47bf5a 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ These options are available when running with --long (`-l`): - **-u**, **--accessed**: use the accessed timestamp field - **-U**, **--created**: use the created timestamp field - **-@**, **--extended**: list each file's extended attributes and sizes -- **--git**: list each file's Git status, if tracked +- **--git**: list each file's Git status, if tracked or ignored - **--time-style**: how to format timestamps - Valid **--color** options are **always**, **automatic**, and **never**. diff --git a/src/fs/feature/git.rs b/src/fs/feature/git.rs index d0d5bce5..40da73eb 100644 --- a/src/fs/feature/git.rs +++ b/src/fs/feature/git.rs @@ -279,6 +279,7 @@ fn working_tree_status(status: git2::Status) -> f::GitStatus { s if s.contains(git2::Status::WT_DELETED) => f::GitStatus::Deleted, s if s.contains(git2::Status::WT_RENAMED) => f::GitStatus::Renamed, s if s.contains(git2::Status::WT_TYPECHANGE) => f::GitStatus::TypeChange, + s if s.contains(git2::Status::IGNORED) => f::GitStatus::Ignored, _ => f::GitStatus::NotModified, } } diff --git a/src/fs/fields.rs b/src/fs/fields.rs index 26d89397..358a297f 100644 --- a/src/fs/fields.rs +++ b/src/fs/fields.rs @@ -197,6 +197,9 @@ pub enum GitStatus { /// A file that’s had its type (such as the file permissions) changed. TypeChange, + + /// A file that’s ignored (that matches a line in .gitignore) + Ignored, } /// A file’s complete Git status. It’s possible to make changes to a file, add diff --git a/src/options/help.rs b/src/options/help.rs index a00864a2..ffbdf37c 100644 --- a/src/options/help.rs +++ b/src/options/help.rs @@ -50,7 +50,7 @@ LONG VIEW OPTIONS -U, --created use the created timestamp field --time-style how to format timestamps (default, iso, long-iso, full-iso)"##; -static GIT_HELP: &str = r##" --git list each file's Git status, if tracked"##; +static GIT_HELP: &str = r##" --git list each file's Git status, if tracked or ignored"##; static EXTENDED_HELP: &str = r##" -@, --extended list each file's extended attributes and sizes"##; diff --git a/src/output/render/git.rs b/src/output/render/git.rs index 41dfbd23..249eada2 100644 --- a/src/output/render/git.rs +++ b/src/output/render/git.rs @@ -26,6 +26,7 @@ impl f::GitStatus { f::GitStatus::Deleted => colours.deleted().paint("D"), f::GitStatus::Renamed => colours.renamed().paint("R"), f::GitStatus::TypeChange => colours.type_change().paint("T"), + f::GitStatus::Ignored => colours.ignored().paint("I"), } } } @@ -38,6 +39,7 @@ pub trait Colours { fn deleted(&self) -> Style; fn renamed(&self) -> Style; fn type_change(&self) -> Style; + fn ignored(&self) -> Style; } @@ -60,6 +62,7 @@ pub mod test { fn deleted(&self) -> Style { Fixed(93).normal() } fn renamed(&self) -> Style { Fixed(94).normal() } fn type_change(&self) -> Style { Fixed(95).normal() } + fn ignored(&self) -> Style { Fixed(96).normal() } } diff --git a/src/style/colours.rs b/src/style/colours.rs index d2186358..0510c90e 100644 --- a/src/style/colours.rs +++ b/src/style/colours.rs @@ -101,6 +101,7 @@ pub struct Git { pub deleted: Style, pub renamed: Style, pub typechange: Style, + pub ignored: Style, } impl Colours { @@ -177,6 +178,7 @@ impl Colours { deleted: Red.normal(), renamed: Yellow.normal(), typechange: Purple.normal(), + ignored: Style::default().dimmed(), }, punctuation: Fixed(244).normal(), @@ -326,6 +328,7 @@ impl render::GitColours for Colours { fn deleted(&self) -> Style { self.git.deleted } fn renamed(&self) -> Style { self.git.renamed } fn type_change(&self) -> Style { self.git.typechange } + fn ignored(&self) -> Style { self.git.ignored } } impl render::GroupColours for Colours { @@ -400,4 +403,3 @@ impl FileNameColours for Colours { fn symlink_path(&self) -> Style { self.symlink_path } fn executable_file(&self) -> Style { self.filekinds.executable } } - From 649744dc825b8e21c1b86bd3b11c122cf7b8d3ba Mon Sep 17 00:00:00 2001 From: ariasuni Date: Tue, 20 Nov 2018 17:27:16 +0100 Subject: [PATCH 6/7] Use more accurate time to fix inconsistent sorting --- src/fs/fields.rs | 2 +- src/fs/filter.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fs/fields.rs b/src/fs/fields.rs index 26d89397..14ba446d 100644 --- a/src/fs/fields.rs +++ b/src/fs/fields.rs @@ -167,7 +167,7 @@ pub struct DeviceIDs { /// One of a file’s timestamps (created, accessed, or modified). -#[derive(Copy, Clone)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Time { pub seconds: time_t, pub nanoseconds: time_t, diff --git a/src/fs/filter.rs b/src/fs/filter.rs index 3b7cd4dd..82440ce9 100644 --- a/src/fs/filter.rs +++ b/src/fs/filter.rs @@ -245,10 +245,10 @@ impl SortField { SortField::Size => a.metadata.len().cmp(&b.metadata.len()), SortField::FileInode => a.metadata.ino().cmp(&b.metadata.ino()), - SortField::ModifiedDate => a.metadata.mtime().cmp(&b.metadata.mtime()), - SortField::AccessedDate => a.metadata.atime().cmp(&b.metadata.atime()), - SortField::CreatedDate => a.metadata.ctime().cmp(&b.metadata.ctime()), - SortField::ModifiedAge => b.metadata.mtime().cmp(&a.metadata.mtime()), // flip b and a + SortField::ModifiedDate => a.modified_time().cmp(&b.modified_time()), + SortField::AccessedDate => a.accessed_time().cmp(&b.accessed_time()), + SortField::CreatedDate => a.created_time().cmp(&b.created_time()), + SortField::ModifiedAge => b.modified_time().cmp(&a.modified_time()), // flip b and a SortField::FileType => match a.type_char().cmp(&b.type_char()) { // todo: this recomputes Ordering::Equal => natord::compare(&*a.name, &*b.name), From 058b4a57bdb1e25cbdacc0fbd1eefc09bc5f1e95 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Fri, 7 Dec 2018 00:59:05 +0000 Subject: [PATCH 7/7] Bump users crate version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And remove an unnecessary allocation while we’re at it. Fixes #442 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/output/render/groups.rs | 4 ++-- src/output/render/users.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8fa1906b..4e26b491 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,7 +99,7 @@ dependencies = [ "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "zoneinfo_compiled 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -404,7 +404,7 @@ dependencies = [ [[package]] name = "users" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -522,7 +522,7 @@ dependencies = [ "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f808aadd8cfec6ef90e4a14eb46f24511824d1ac596b9682703c87056c8678b7" -"checksum users 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caa2760fcc10a6ae2c2a35d41c5d69827e4663f0d3889ecfb4d60b343f4139df" +"checksum users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fed7d0912567d35f88010c23dbaf865e9da8b5227295e8dc0f2fdd109155ab7" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/Cargo.toml b/Cargo.toml index 2a5020ab..c321b628 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ scoped_threadpool = "0.1.*" term_grid = "0.1.6" term_size = "0.3.0" unicode-width = "0.1.4" -users = "0.7" +users = "0.8" zoneinfo_compiled = "0.4.7" [build-dependencies] diff --git a/src/output/render/groups.rs b/src/output/render/groups.rs index 6504e889..a3a25e70 100644 --- a/src/output/render/groups.rs +++ b/src/output/render/groups.rs @@ -19,12 +19,12 @@ impl f::Group { let current_uid = users.get_current_uid(); if let Some(current_user) = users.get_user_by_uid(current_uid) { if current_user.primary_group_id() == group.gid() - || group.members().contains(¤t_user.name().to_owned()) { + || group.members().iter().any(|u| u == current_user.name()) { style = colours.yours(); } } - TextCell::paint(style, group.name().to_owned()) + TextCell::paint(style, group.name().to_string_lossy().into()) } } diff --git a/src/output/render/users.rs b/src/output/render/users.rs index 75ff4c6f..d7edefac 100644 --- a/src/output/render/users.rs +++ b/src/output/render/users.rs @@ -9,7 +9,7 @@ use output::cell::TextCell; impl f::User { pub fn render(&self, colours: &C, users: &U) -> TextCell { let user_name = match users.get_user_by_uid(self.0) { - Some(user) => user.name().to_owned(), + Some(user) => user.name().to_string_lossy().into(), None => self.0.to_string(), };