mirror of
https://github.com/eza-community/eza
synced 2024-09-06 00:13:51 +00:00
Use ansi_term's awesome new continuation colours
This commit is contained in:
parent
113df66408
commit
d180a5f5e4
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2,7 +2,7 @@
|
|||
name = "exa"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ansi_term 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"datetime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -15,12 +15,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.4.6"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex_macros 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
|
|
@ -7,7 +7,7 @@ authors = [ "ogham@bsago.me" ]
|
|||
name = "exa"
|
||||
|
||||
[dependencies]
|
||||
ansi_term = "0.4.6"
|
||||
ansi_term = "0.5.0"
|
||||
datetime = "0.1.3"
|
||||
#datetime_macros = "0.1.2"
|
||||
getopts = "0.2.1"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::old_io::{fs, IoResult};
|
||||
use file::{File, GREY};
|
||||
|
||||
#[cfg(feature="git")] use ansi_term::ANSIString;
|
||||
#[cfg(feature="git")] use ansi_term::{ANSIString, ANSIStrings};
|
||||
#[cfg(feature="git")] use ansi_term::Colour::*;
|
||||
#[cfg(feature="git")] use git2;
|
||||
|
||||
|
@ -96,7 +96,7 @@ impl Git {
|
|||
let status = self.statuses.iter()
|
||||
.find(|p| p.0 == path.as_vec());
|
||||
match status {
|
||||
Some(&(_, s)) => format!("{}{}", Git::index_status(s), Git::working_tree_status(s)),
|
||||
Some(&(_, s)) => ANSIStrings( &[Git::index_status(s), Git::working_tree_status(s) ]).to_string(),
|
||||
None => GREY.paint("--").to_string(),
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ impl Git {
|
|||
.filter(|p| p.0.starts_with(dir.as_vec()))
|
||||
.fold(git2::Status::empty(), |a, b| a | b.1);
|
||||
|
||||
format!("{}{}", Git::index_status(s), Git::working_tree_status(s))
|
||||
ANSIStrings( &[Git::index_status(s), Git::working_tree_status(s)] ).to_string()
|
||||
}
|
||||
|
||||
/// The character to display if the file has been modified, but not staged.
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::old_io::{fs, IoResult};
|
|||
use std::old_io as io;
|
||||
use std::ascii::AsciiExt;
|
||||
|
||||
use ansi_term::{ANSIString, Colour, Style};
|
||||
use ansi_term::{ANSIString, ANSIStrings, Colour, Style};
|
||||
use ansi_term::Style::Plain;
|
||||
use ansi_term::Colour::{Red, Green, Yellow, Blue, Purple, Cyan, Fixed};
|
||||
|
||||
|
@ -296,7 +296,7 @@ impl<'a> File<'a> {
|
|||
let symbol = prefix.symbol();
|
||||
|
||||
Cell {
|
||||
text: format!("{}{}", Green.bold().paint(&*number), Green.paint(symbol)),
|
||||
text: ANSIStrings( &[ Green.bold().paint(&number[]), Green.paint(symbol) ]).to_string(),
|
||||
length: number.len() + symbol.len(),
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ impl<'a> File<'a> {
|
|||
_ => Green.bold(),
|
||||
};
|
||||
|
||||
let string = format!("{}{}{}{}{}{}{}{}{}{}",
|
||||
let string = ANSIStrings(&[
|
||||
self.type_char(),
|
||||
File::permission_bit(&bits, io::USER_READ, "r", Yellow.bold()),
|
||||
File::permission_bit(&bits, io::USER_WRITE, "w", Red.bold()),
|
||||
|
@ -363,7 +363,7 @@ impl<'a> File<'a> {
|
|||
File::permission_bit(&bits, io::OTHER_READ, "r", Yellow.normal()),
|
||||
File::permission_bit(&bits, io::OTHER_WRITE, "w", Red.normal()),
|
||||
File::permission_bit(&bits, io::OTHER_EXECUTE, "x", Green.normal()),
|
||||
);
|
||||
]).to_string();
|
||||
|
||||
Cell { text: string, length: 10 }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue