mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-02-02 02:28:24 +00:00
Merge branch 'master' into chesterliu/dev/win-support
This commit is contained in:
commit
78a3bc9838
@ -47,6 +47,7 @@ exa’s options are almost, but not quite, entirely unlike `ls`’s.
|
|||||||
- **--colo[u]r**: when to use terminal colours
|
- **--colo[u]r**: when to use terminal colours
|
||||||
- **--colo[u]r-scale**: highlight levels of file sizes distinctly
|
- **--colo[u]r-scale**: highlight levels of file sizes distinctly
|
||||||
- **--icons**: display icons
|
- **--icons**: display icons
|
||||||
|
- **--no-icons**: don't display icons (always overrides --icons)
|
||||||
|
|
||||||
### Filtering options
|
### Filtering options
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ These options are available when running with `--long` (`-l`):
|
|||||||
- **--git**: list each file’s Git status, if tracked or ignored
|
- **--git**: list each file’s Git status, if tracked or ignored
|
||||||
- **--time-style**: how to format timestamps
|
- **--time-style**: how to format timestamps
|
||||||
- **--no-permissions**: suppress the permissions field
|
- **--no-permissions**: suppress the permissions field
|
||||||
|
- **--octal-permissions**: list each file's permission in octal format
|
||||||
- **--no-filesize**: suppress the filesize field
|
- **--no-filesize**: suppress the filesize field
|
||||||
- **--no-user**: suppress the user field
|
- **--no-user**: suppress the user field
|
||||||
- **--no-time**: suppress the time field
|
- **--no-time**: suppress the time field
|
||||||
|
@ -15,6 +15,7 @@ complete -c exa -l 'colour' -d "When to use terminal colours"
|
|||||||
complete -c exa -l 'color-scale' -d "Highlight levels of file sizes distinctly"
|
complete -c exa -l 'color-scale' -d "Highlight levels of file sizes distinctly"
|
||||||
complete -c exa -l 'colour-scale' -d "Highlight levels of file sizes distinctly"
|
complete -c exa -l 'colour-scale' -d "Highlight levels of file sizes distinctly"
|
||||||
complete -c exa -l 'icons' -d "Display icons"
|
complete -c exa -l 'icons' -d "Display icons"
|
||||||
|
complete -c exa -l 'no-icons' -d "Don't display icons"
|
||||||
|
|
||||||
# Filtering and sorting options
|
# Filtering and sorting options
|
||||||
complete -c exa -l 'group-directories-first' -d "Sort directories before other files"
|
complete -c exa -l 'group-directories-first' -d "Sort directories before other files"
|
||||||
@ -75,6 +76,7 @@ complete -c exa -l 'time-style' -x -d "How to format timestamps" -a "
|
|||||||
full-iso\t'Display full ISO timestamps, up to the nanosecond'
|
full-iso\t'Display full ISO timestamps, up to the nanosecond'
|
||||||
"
|
"
|
||||||
complete -c exa -l 'no-permissions' -d "Suppress the permissions field"
|
complete -c exa -l 'no-permissions' -d "Suppress the permissions field"
|
||||||
|
complete -c exa -l 'octal-permissions' -d "List each file's permission in octal format"
|
||||||
complete -c exa -l 'no-filesize' -d "Suppress the filesize field"
|
complete -c exa -l 'no-filesize' -d "Suppress the filesize field"
|
||||||
complete -c exa -l 'no-user' -d "Suppress the user field"
|
complete -c exa -l 'no-user' -d "Suppress the user field"
|
||||||
complete -c exa -l 'no-time' -d "Suppress the time field"
|
complete -c exa -l 'no-time' -d "Suppress the time field"
|
||||||
|
@ -22,6 +22,7 @@ __exa() {
|
|||||||
--colo{,u}r"[When to use terminal colours]" \
|
--colo{,u}r"[When to use terminal colours]" \
|
||||||
--colo{,u}r-scale"[Highlight levels of file sizes distinctly]" \
|
--colo{,u}r-scale"[Highlight levels of file sizes distinctly]" \
|
||||||
--icons"[Display icons]" \
|
--icons"[Display icons]" \
|
||||||
|
--no-icons"[Hide icons]" \
|
||||||
--group-directories-first"[Sort directories before other files]" \
|
--group-directories-first"[Sort directories before other files]" \
|
||||||
--git-ignore"[Ignore files mentioned in '.gitignore']" \
|
--git-ignore"[Ignore files mentioned in '.gitignore']" \
|
||||||
{-a,--all}"[Show hidden and 'dot' files]" \
|
{-a,--all}"[Show hidden and 'dot' files]" \
|
||||||
@ -43,6 +44,7 @@ __exa() {
|
|||||||
{-t,--time}="[Which time field to show]:(time field):(accessed changed created modified)" \
|
{-t,--time}="[Which time field to show]:(time field):(accessed changed created modified)" \
|
||||||
--time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso)" \
|
--time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso)" \
|
||||||
--no-permissions"[Suppress the permissions field]" \
|
--no-permissions"[Suppress the permissions field]" \
|
||||||
|
--octal-permissions"[List each file's permission in octal format]" \
|
||||||
--no-filesize"[Suppress the filesize field]" \
|
--no-filesize"[Suppress the filesize field]" \
|
||||||
--no-user"[Suppress the user field]" \
|
--no-user"[Suppress the user field]" \
|
||||||
--no-time"[Suppress the time field]" \
|
--no-time"[Suppress the time field]" \
|
||||||
|
@ -72,6 +72,9 @@ Valid settings are ‘`always`’, ‘`automatic`’, and ‘`never`’.
|
|||||||
`--icons`
|
`--icons`
|
||||||
: Display icons next to file names.
|
: Display icons next to file names.
|
||||||
|
|
||||||
|
`--no-icons`
|
||||||
|
: Don't display icons. (Always overrides --icons)
|
||||||
|
|
||||||
|
|
||||||
FILTERING AND SORTING OPTIONS
|
FILTERING AND SORTING OPTIONS
|
||||||
=============================
|
=============================
|
||||||
@ -101,7 +104,7 @@ Sort fields starting with a capital letter will sort uppercase before lowercase:
|
|||||||
`-I`, `--ignore-glob=GLOBS`
|
`-I`, `--ignore-glob=GLOBS`
|
||||||
: Glob patterns, pipe-separated, of files to ignore.
|
: Glob patterns, pipe-separated, of files to ignore.
|
||||||
|
|
||||||
`--git-ignore`
|
`--git-ignore` [if exa was built with git support]
|
||||||
: Do not list files that are ignored by Git.
|
: Do not list files that are ignored by Git.
|
||||||
|
|
||||||
`--group-directories-first`
|
`--group-directories-first`
|
||||||
@ -174,7 +177,7 @@ These options are available when running with `--long` (`-l`):
|
|||||||
`-@`, `--extended`
|
`-@`, `--extended`
|
||||||
: List each file’s extended attributes and sizes.
|
: List each file’s extended attributes and sizes.
|
||||||
|
|
||||||
`--git`
|
`--git` [if exa was built with git support]
|
||||||
: List each file’s Git status, if tracked.
|
: List each file’s Git status, if tracked.
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ pub mod git {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self, _index: &Path, _prefix_lookup: bool) -> f::Git {
|
pub fn get(&self, _index: &Path, _prefix_lookup: bool) -> f::Git {
|
||||||
panic!("Tried to query a Git cache, but Git support is disabled")
|
unreachable!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,7 @@ use std::io;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
|
||||||
pub const ENABLED: bool =
|
pub const ENABLED: bool = cfg!(any(target_os = "macos", target_os = "linux"));
|
||||||
cfg!(feature="git") &&
|
|
||||||
cfg!(any(target_os = "macos", target_os = "linux"));
|
|
||||||
|
|
||||||
|
|
||||||
pub trait FileAttributes {
|
pub trait FileAttributes {
|
||||||
|
@ -264,13 +264,15 @@ impl<'args> Exa<'args> {
|
|||||||
|
|
||||||
match (mode, self.console_width) {
|
match (mode, self.console_width) {
|
||||||
(Mode::Grid(ref opts), Some(console_width)) => {
|
(Mode::Grid(ref opts), Some(console_width)) => {
|
||||||
let r = grid::Render { files, theme, file_style, opts, console_width };
|
let filter = &self.options.filter;
|
||||||
|
let r = grid::Render { files, theme, file_style, opts, console_width, filter };
|
||||||
r.render(&mut self.writer)
|
r.render(&mut self.writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
(Mode::Grid(_), None) |
|
(Mode::Grid(_), None) |
|
||||||
(Mode::Lines, _) => {
|
(Mode::Lines, _) => {
|
||||||
let r = lines::Render { files, theme, file_style };
|
let filter = &self.options.filter;
|
||||||
|
let r = lines::Render { files, theme, file_style, filter };
|
||||||
r.render(&mut self.writer)
|
r.render(&mut self.writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ pub enum OptionsError {
|
|||||||
/// The user supplied an illegal choice to an Argument.
|
/// The user supplied an illegal choice to an Argument.
|
||||||
BadArgument(&'static Arg, OsString),
|
BadArgument(&'static Arg, OsString),
|
||||||
|
|
||||||
/// The user supplied a set of options
|
/// The user supplied a set of options that are unsupported
|
||||||
Unsupported(String),
|
Unsupported(String),
|
||||||
|
|
||||||
/// An option was given twice or more in strict mode.
|
/// An option was given twice or more in strict mode.
|
||||||
|
@ -25,7 +25,7 @@ impl Classify {
|
|||||||
|
|
||||||
impl ShowIcons {
|
impl ShowIcons {
|
||||||
pub fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
pub fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
if ! matches.has(&flags::ICONS)? {
|
if matches.has(&flags::NO_ICONS)? || !matches.has(&flags::ICONS)? {
|
||||||
Ok(Self::Off)
|
Ok(Self::Off)
|
||||||
}
|
}
|
||||||
else if let Some(columns) = vars.get(vars::EXA_ICON_SPACING).and_then(|s| s.into_string().ok()) {
|
else if let Some(columns) = vars.get(vars::EXA_ICON_SPACING).and_then(|s| s.into_string().ok()) {
|
||||||
|
@ -58,6 +58,7 @@ pub static NO_PERMISSIONS: Arg = Arg { short: None, long: "no-permissions", take
|
|||||||
pub static NO_FILESIZE: Arg = Arg { short: None, long: "no-filesize", takes_value: TakesValue::Forbidden };
|
pub static NO_FILESIZE: Arg = Arg { short: None, long: "no-filesize", takes_value: TakesValue::Forbidden };
|
||||||
pub static NO_USER: Arg = Arg { short: None, long: "no-user", takes_value: TakesValue::Forbidden };
|
pub static NO_USER: Arg = Arg { short: None, long: "no-user", takes_value: TakesValue::Forbidden };
|
||||||
pub static NO_TIME: Arg = Arg { short: None, long: "no-time", takes_value: TakesValue::Forbidden };
|
pub static NO_TIME: Arg = Arg { short: None, long: "no-time", takes_value: TakesValue::Forbidden };
|
||||||
|
pub static NO_ICONS: Arg = Arg { short: None, long: "no-icons", takes_value: TakesValue::Forbidden };
|
||||||
|
|
||||||
// optional feature options
|
// optional feature options
|
||||||
pub static GIT: Arg = Arg { short: None, long: "git", takes_value: TakesValue::Forbidden };
|
pub static GIT: Arg = Arg { short: None, long: "git", takes_value: TakesValue::Forbidden };
|
||||||
@ -76,7 +77,7 @@ pub static ALL_ARGS: Args = Args(&[
|
|||||||
|
|
||||||
&BINARY, &BYTES, &GROUP, &HEADER, &ICONS, &INODE, &LINKS, &MODIFIED, &CHANGED,
|
&BINARY, &BYTES, &GROUP, &HEADER, &ICONS, &INODE, &LINKS, &MODIFIED, &CHANGED,
|
||||||
&BLOCKS, &TIME, &ACCESSED, &CREATED, &TIME_STYLE,
|
&BLOCKS, &TIME, &ACCESSED, &CREATED, &TIME_STYLE,
|
||||||
&NO_PERMISSIONS, &NO_FILESIZE, &NO_USER, &NO_TIME,
|
&NO_PERMISSIONS, &NO_FILESIZE, &NO_USER, &NO_TIME, &NO_ICONS,
|
||||||
|
|
||||||
&GIT, &EXTENDED, &OCTAL
|
&GIT, &EXTENDED, &OCTAL
|
||||||
]);
|
]);
|
||||||
|
@ -5,7 +5,7 @@ use crate::options::flags;
|
|||||||
use crate::options::parser::MatchedFlags;
|
use crate::options::parser::MatchedFlags;
|
||||||
|
|
||||||
|
|
||||||
static USAGE: &str = r##"Usage:
|
static USAGE_PART1: &str = "Usage:
|
||||||
exa [options] [files...]
|
exa [options] [files...]
|
||||||
|
|
||||||
META OPTIONS
|
META OPTIONS
|
||||||
@ -23,6 +23,7 @@ DISPLAY OPTIONS
|
|||||||
--colo[u]r=WHEN when to use terminal colours (always, auto, never)
|
--colo[u]r=WHEN when to use terminal colours (always, auto, never)
|
||||||
--colo[u]r-scale highlight levels of file sizes distinctly
|
--colo[u]r-scale highlight levels of file sizes distinctly
|
||||||
--icons display icons
|
--icons display icons
|
||||||
|
--no-icons don't display icons (always overrides --icons)
|
||||||
|
|
||||||
FILTERING AND SORTING OPTIONS
|
FILTERING AND SORTING OPTIONS
|
||||||
-a, --all show hidden and 'dot' files
|
-a, --all show hidden and 'dot' files
|
||||||
@ -32,8 +33,9 @@ FILTERING AND SORTING OPTIONS
|
|||||||
-s, --sort SORT_FIELD which field to sort by
|
-s, --sort SORT_FIELD which field to sort by
|
||||||
--group-directories-first list directories before other files
|
--group-directories-first list directories before other files
|
||||||
-D, --only-dirs list only directories
|
-D, --only-dirs list only directories
|
||||||
-I, --ignore-glob GLOBS glob patterns (pipe-separated) of files to ignore
|
-I, --ignore-glob GLOBS glob patterns (pipe-separated) of files to ignore";
|
||||||
--git-ignore ignore files mentioned in '.gitignore'
|
|
||||||
|
static USAGE_PART2: &str = " \
|
||||||
Valid sort fields: name, Name, extension, Extension, size, type,
|
Valid sort fields: name, Name, extension, Extension, size, type,
|
||||||
modified, accessed, created, inode, and none.
|
modified, accessed, created, inode, and none.
|
||||||
date, time, old, and new all refer to modified.
|
date, time, old, and new all refer to modified.
|
||||||
@ -56,10 +58,11 @@ LONG VIEW OPTIONS
|
|||||||
--octal-permissions list each file's permission in octal format
|
--octal-permissions list each file's permission in octal format
|
||||||
--no-filesize suppress the filesize field
|
--no-filesize suppress the filesize field
|
||||||
--no-user suppress the user field
|
--no-user suppress the user field
|
||||||
--no-time suppress the time field"##;
|
--no-time suppress the time field";
|
||||||
|
|
||||||
static GIT_HELP: &str = r##" --git list each file's Git status, if tracked or ignored"##;
|
static GIT_FILTER_HELP: &str = " --git-ignore ignore files mentioned in '.gitignore'";
|
||||||
static EXTENDED_HELP: &str = r##" -@, --extended list each file's extended attributes and sizes"##;
|
static GIT_VIEW_HELP: &str = " --git list each file's Git status, if tracked or ignored";
|
||||||
|
static EXTENDED_HELP: &str = " -@, --extended list each file's extended attributes and sizes";
|
||||||
|
|
||||||
|
|
||||||
/// All the information needed to display the help text, which depends
|
/// All the information needed to display the help text, which depends
|
||||||
@ -92,14 +95,20 @@ impl fmt::Display for HelpString {
|
|||||||
/// Format this help options into an actual string of help
|
/// Format this help options into an actual string of help
|
||||||
/// text to be displayed to the user.
|
/// text to be displayed to the user.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
writeln!(f, "{}", USAGE)?;
|
write!(f, "{}", USAGE_PART1)?;
|
||||||
|
|
||||||
if cfg!(feature="git") {
|
if cfg!(feature = "git") {
|
||||||
writeln!(f, "{}", GIT_HELP)?;
|
write!(f, "\n{}", GIT_FILTER_HELP)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
write!(f, "\n{}", USAGE_PART2)?;
|
||||||
|
|
||||||
|
if cfg!(feature = "git") {
|
||||||
|
write!(f, "\n{}", GIT_VIEW_HELP)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if xattr::ENABLED {
|
if xattr::ENABLED {
|
||||||
writeln!(f, "{}", EXTENDED_HELP)?;
|
write!(f, "\n{}", EXTENDED_HELP)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -176,6 +176,13 @@ impl Options {
|
|||||||
/// Determines the complete set of options based on the given command-line
|
/// Determines the complete set of options based on the given command-line
|
||||||
/// arguments, after they’ve been parsed.
|
/// arguments, after they’ve been parsed.
|
||||||
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
|
||||||
|
if cfg!(not(feature = "git")) &&
|
||||||
|
matches.has_where_any(|f| f.matches(&flags::GIT) || f.matches(&flags::GIT_IGNORE)).is_some() {
|
||||||
|
return Err(OptionsError::Unsupported(format!(
|
||||||
|
"Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa"
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
let view = View::deduce(matches, vars)?;
|
let view = View::deduce(matches, vars)?;
|
||||||
let dir_action = DirAction::deduce(matches, matches!(view.mode, Mode::Details(_)))?;
|
let dir_action = DirAction::deduce(matches, matches!(view.mode, Mode::Details(_)))?;
|
||||||
let filter = FileFilter::deduce(matches)?;
|
let filter = FileFilter::deduce(matches)?;
|
||||||
|
@ -31,7 +31,11 @@ impl VersionString {
|
|||||||
|
|
||||||
impl fmt::Display for VersionString {
|
impl fmt::Display for VersionString {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
writeln!(f, "{}", include!(concat!(env!("OUT_DIR"), "/version_string.txt")))
|
writeln!(
|
||||||
|
f,
|
||||||
|
"{} (git support: {})",
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/version_string.txt")),
|
||||||
|
if cfg!(feature = "git") { "enabled" } else { "disabled" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ impl Mode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "git") && matches.has(&flags::GIT)? {
|
if matches.has(&flags::GIT)? {
|
||||||
return Err(OptionsError::Useless(&flags::GIT, false, &flags::LONG));
|
return Err(OptionsError::Useless(&flags::GIT, false, &flags::LONG));
|
||||||
}
|
}
|
||||||
else if matches.has(&flags::LEVEL)? && ! matches.has(&flags::RECURSE)? && ! matches.has(&flags::TREE)? {
|
else if matches.has(&flags::LEVEL)? && ! matches.has(&flags::RECURSE)? && ! matches.has(&flags::TREE)? {
|
||||||
@ -192,7 +192,7 @@ impl TableOptions {
|
|||||||
impl Columns {
|
impl Columns {
|
||||||
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||||
let time_types = TimeTypes::deduce(matches)?;
|
let time_types = TimeTypes::deduce(matches)?;
|
||||||
let git = cfg!(feature = "git") && matches.has(&flags::GIT)?;
|
let git = matches.has(&flags::GIT)?;
|
||||||
|
|
||||||
let blocks = matches.has(&flags::BLOCKS)?;
|
let blocks = matches.has(&flags::BLOCKS)?;
|
||||||
let group = matches.has(&flags::GROUP)?;
|
let group = matches.has(&flags::GROUP)?;
|
||||||
|
@ -132,9 +132,9 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|||||||
bits.push(style.paint(file_icon));
|
bits.push(style.paint(file_icon));
|
||||||
|
|
||||||
match spaces_count {
|
match spaces_count {
|
||||||
1 => bits.push(Style::default().paint(" ")),
|
1 => bits.push(style.paint(" ")),
|
||||||
2 => bits.push(Style::default().paint(" ")),
|
2 => bits.push(style.paint(" ")),
|
||||||
n => bits.push(Style::default().paint(spaces(n))),
|
n => bits.push(style.paint(spaces(n))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ use std::io::{self, Write};
|
|||||||
use term_grid as tg;
|
use term_grid as tg;
|
||||||
|
|
||||||
use crate::fs::File;
|
use crate::fs::File;
|
||||||
|
use crate::fs::filter::FileFilter;
|
||||||
use crate::output::file_name::Options as FileStyle;
|
use crate::output::file_name::Options as FileStyle;
|
||||||
use crate::theme::Theme;
|
use crate::theme::Theme;
|
||||||
|
|
||||||
@ -26,10 +27,11 @@ pub struct Render<'a> {
|
|||||||
pub file_style: &'a FileStyle,
|
pub file_style: &'a FileStyle,
|
||||||
pub opts: &'a Options,
|
pub opts: &'a Options,
|
||||||
pub console_width: usize,
|
pub console_width: usize,
|
||||||
|
pub filter: &'a FileFilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Render<'a> {
|
impl<'a> Render<'a> {
|
||||||
pub fn render<W: Write>(&self, w: &mut W) -> io::Result<()> {
|
pub fn render<W: Write>(mut self, w: &mut W) -> io::Result<()> {
|
||||||
let mut grid = tg::Grid::new(tg::GridOptions {
|
let mut grid = tg::Grid::new(tg::GridOptions {
|
||||||
direction: self.opts.direction(),
|
direction: self.opts.direction(),
|
||||||
filling: tg::Filling::Spaces(2),
|
filling: tg::Filling::Spaces(2),
|
||||||
@ -37,6 +39,7 @@ impl<'a> Render<'a> {
|
|||||||
|
|
||||||
grid.reserve(self.files.len());
|
grid.reserve(self.files.len());
|
||||||
|
|
||||||
|
self.filter.sort_files(&mut self.files);
|
||||||
for file in &self.files {
|
for file in &self.files {
|
||||||
let filename = self.file_style.for_file(file, self.theme).paint();
|
let filename = self.file_style.for_file(file, self.theme).paint();
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ use ansi_term::Style;
|
|||||||
|
|
||||||
use crate::fs::File;
|
use crate::fs::File;
|
||||||
use crate::info::filetype::FileExtensions;
|
use crate::info::filetype::FileExtensions;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
|
||||||
pub trait FileIcon {
|
pub trait FileIcon {
|
||||||
@ -42,156 +44,293 @@ pub fn iconify_style<'a>(style: Style) -> Style {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref MAP_BY_NAME: HashMap<&'static str, char> = {
|
||||||
|
let mut m = HashMap::new();
|
||||||
|
m.insert(".Trash", '\u{f1f8}'); //
|
||||||
|
m.insert(".atom", '\u{e764}'); //
|
||||||
|
m.insert(".bashprofile", '\u{e615}'); //
|
||||||
|
m.insert(".bashrc", '\u{f489}'); //
|
||||||
|
m.insert(".git", '\u{f1d3}'); //
|
||||||
|
m.insert(".gitattributes", '\u{f1d3}'); //
|
||||||
|
m.insert(".gitconfig", '\u{f1d3}'); //
|
||||||
|
m.insert(".github", '\u{f408}'); //
|
||||||
|
m.insert(".gitignore", '\u{f1d3}'); //
|
||||||
|
m.insert(".gitmodules", '\u{f1d3}'); //
|
||||||
|
m.insert(".rvm", '\u{e21e}'); //
|
||||||
|
m.insert(".vimrc", '\u{e62b}'); //
|
||||||
|
m.insert(".vscode", '\u{e70c}'); //
|
||||||
|
m.insert(".zshrc", '\u{f489}'); //
|
||||||
|
m.insert("Cargo.lock", '\u{e7a8}'); //
|
||||||
|
m.insert("bin", '\u{e5fc}'); //
|
||||||
|
m.insert("config", '\u{e5fc}'); //
|
||||||
|
m.insert("docker-compose.yml", '\u{f308}'); //
|
||||||
|
m.insert("Dockerfile", '\u{f308}'); //
|
||||||
|
m.insert("ds_store", '\u{f179}'); //
|
||||||
|
m.insert("gitignore_global", '\u{f1d3}'); //
|
||||||
|
m.insert("gradle", '\u{e70e}'); //
|
||||||
|
m.insert("gruntfile.coffee", '\u{e611}'); //
|
||||||
|
m.insert("gruntfile.js", '\u{e611}'); //
|
||||||
|
m.insert("gruntfile.ls", '\u{e611}'); //
|
||||||
|
m.insert("gulpfile.coffee", '\u{e610}'); //
|
||||||
|
m.insert("gulpfile.js", '\u{e610}'); //
|
||||||
|
m.insert("gulpfile.ls", '\u{e610}'); //
|
||||||
|
m.insert("hidden", '\u{f023}'); //
|
||||||
|
m.insert("include", '\u{e5fc}'); //
|
||||||
|
m.insert("lib", '\u{f121}'); //
|
||||||
|
m.insert("localized", '\u{f179}'); //
|
||||||
|
m.insert("Makefile", '\u{e779}'); //
|
||||||
|
m.insert("node_modules", '\u{e718}'); //
|
||||||
|
m.insert("npmignore", '\u{e71e}'); //
|
||||||
|
m.insert("rubydoc", '\u{e73b}'); //
|
||||||
|
m.insert("yarn.lock", '\u{e718}'); //
|
||||||
|
|
||||||
|
m
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
pub fn icon_for_file(file: &File<'_>) -> char {
|
pub fn icon_for_file(file: &File<'_>) -> char {
|
||||||
let extensions = Box::new(FileExtensions);
|
let extensions = Box::new(FileExtensions);
|
||||||
|
|
||||||
if file.points_to_directory() {
|
if let Some(icon) = MAP_BY_NAME.get(file.name.as_str()) { *icon }
|
||||||
'\u{f115}'
|
else if file.points_to_directory() {
|
||||||
}
|
match file.name.as_str() {
|
||||||
else if let Some(icon) = extensions.icon_file(file) {
|
"bin" => '\u{e5fc}', //
|
||||||
icon
|
".git" => '\u{f1d3}', //
|
||||||
|
".idea" => '\u{e7b5}', //
|
||||||
|
_ => '\u{f115}' //
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if let Some(icon) = extensions.icon_file(file) { icon }
|
||||||
else if let Some(ext) = file.ext.as_ref() {
|
else if let Some(ext) = file.ext.as_ref() {
|
||||||
match ext.as_str() {
|
match ext.as_str() {
|
||||||
"ai" => '\u{e7b4}',
|
"ai" => '\u{e7b4}', //
|
||||||
"android" => '\u{e70e}',
|
"android" => '\u{e70e}', //
|
||||||
"apple" => '\u{f179}',
|
"apk" => '\u{e70e}', //
|
||||||
"avro" => '\u{e60b}',
|
"apple" => '\u{f179}', //
|
||||||
"clj" => '\u{e768}',
|
"avi" => '\u{f03d}', //
|
||||||
"coffee" => '\u{f0f4}',
|
"avro" => '\u{e60b}', //
|
||||||
"cpp" => '\u{e61d}',
|
"awk" => '\u{f489}', //
|
||||||
"hpp" => '\u{e61d}',
|
"bash" => '\u{f489}', //
|
||||||
"c" => '\u{e61e}',
|
"bash_history" => '\u{f489}', //
|
||||||
"h" => '\u{e61e}',
|
"bash_profile" => '\u{f489}', //
|
||||||
"cs" => '\u{f81a}',
|
"bashrc" => '\u{f489}', //
|
||||||
"css" => '\u{e749}',
|
"bat" => '\u{f17a}', //
|
||||||
"d" => '\u{e7af}',
|
"bmp" => '\u{f1c5}', //
|
||||||
"dart" => '\u{e798}',
|
"bz" => '\u{f410}', //
|
||||||
"db" => '\u{f1c0}',
|
"bz2" => '\u{f410}', //
|
||||||
"diff" => '\u{f440}',
|
"c" => '\u{e61e}', //
|
||||||
"patch" => '\u{f440}',
|
"c++" => '\u{e61d}', //
|
||||||
"rtf" => '\u{f1c2}',
|
"cab" => '\u{e70f}', //
|
||||||
"doc" => '\u{f1c2}',
|
"cc" => '\u{e61d}', //
|
||||||
"docx" => '\u{f1c2}',
|
"cfg" => '\u{e615}', //
|
||||||
"odt" => '\u{f1c2}',
|
"class" => '\u{e256}', //
|
||||||
"ebook" => '\u{e28b}',
|
"clj" => '\u{e768}', //
|
||||||
"env" => '\u{f462}',
|
"cljs" => '\u{e76a}', //
|
||||||
"epub" => '\u{e28a}',
|
"cls" => '\u{e600}', //
|
||||||
"erl" => '\u{e7b1}',
|
"cmd" => '\u{e70f}', //
|
||||||
"font" => '\u{f031}',
|
"coffee" => '\u{f0f4}', //
|
||||||
"gform" => '\u{f298}',
|
"conf" => '\u{e615}', //
|
||||||
"git" => '\u{f1d3}',
|
"cp" => '\u{e61d}', //
|
||||||
"go" => '\u{e626}',
|
"cpp" => '\u{e61d}', //
|
||||||
"hs" => '\u{e777}',
|
"cs" => '\u{f81a}', //
|
||||||
"htm" => '\u{f13b}',
|
"csh" => '\u{f489}', //
|
||||||
"html" => '\u{f13b}',
|
"cshtml" => '\u{f1fa}', //
|
||||||
"xhtml" => '\u{f13b}',
|
"csproj" => '\u{f81a}', //
|
||||||
"iml" => '\u{e7b5}',
|
"css" => '\u{e749}', //
|
||||||
"java" => '\u{e204}',
|
"csv" => '\u{f1c3}', //
|
||||||
"js" => '\u{e74e}',
|
"csx" => '\u{f81a}', //
|
||||||
"mjs" => '\u{e74e}',
|
"cxx" => '\u{e61d}', //
|
||||||
"json" => '\u{e60b}',
|
"d" => '\u{e7af}', //
|
||||||
"jsx" => '\u{e7ba}',
|
"dart" => '\u{e798}', //
|
||||||
"vue" => '\u{fd42}',
|
"db" => '\u{f1c0}', //
|
||||||
"node" => '\u{f898}',
|
"deb" => '\u{e77d}', //
|
||||||
"less" => '\u{e758}',
|
"diff" => '\u{f440}', //
|
||||||
"log" => '\u{f18d}',
|
"djvu" => '\u{f02d}', //
|
||||||
"lua" => '\u{e620}',
|
"dll" => '\u{e70f}', //
|
||||||
"md" => '\u{f48a}',
|
"doc" => '\u{f1c2}', //
|
||||||
"markdown" => '\u{f48a}',
|
"docx" => '\u{f1c2}', //
|
||||||
"mustache" => '\u{e60f}',
|
"ds_store" => '\u{f179}', //
|
||||||
"npmignore" => '\u{e71e}',
|
"DS_store" => '\u{f179}', //
|
||||||
"pdf" => '\u{f1c1}',
|
"dump" => '\u{f1c0}', //
|
||||||
"djvu" => '\u{f02d}',
|
"ebook" => '\u{e28b}', //
|
||||||
"mobi" => '\u{f02d}',
|
"editorconfig" => '\u{e615}', //
|
||||||
"php" => '\u{e73d}',
|
"ejs" => '\u{e618}', //
|
||||||
"pl" => '\u{e769}',
|
"elm" => '\u{e62c}', //
|
||||||
"ppt" => '\u{f1c4}',
|
"env" => '\u{f462}', //
|
||||||
"pptx" => '\u{f1c4}',
|
"eot" => '\u{f031}', //
|
||||||
"odp" => '\u{f1c4}',
|
"epub" => '\u{e28a}', //
|
||||||
"psd" => '\u{e7b8}',
|
"erb" => '\u{e73b}', //
|
||||||
"py" => '\u{e606}',
|
"erl" => '\u{e7b1}', //
|
||||||
"r" => '\u{f25d}',
|
"ex" => '\u{e62d}', //
|
||||||
"rb" => '\u{e21e}',
|
"exe" => '\u{f17a}', //
|
||||||
"ru" => '\u{e21e}',
|
"exs" => '\u{e62d}', //
|
||||||
"erb" => '\u{e21e}',
|
"fish" => '\u{f489}', //
|
||||||
"gem" => '\u{e21e}',
|
"flac" => '\u{f001}', //
|
||||||
"rdb" => '\u{e76d}',
|
"flv" => '\u{f03d}', //
|
||||||
"rs" => '\u{e7a8}',
|
"font" => '\u{f031}', //
|
||||||
"rss" => '\u{f09e}',
|
"gdoc" => '\u{f1c2}', //
|
||||||
"rubydoc" => '\u{e73b}',
|
"gem" => '\u{e21e}', //
|
||||||
"sass" => '\u{e74b}',
|
"gemfile" => '\u{e21e}', //
|
||||||
"stylus" => '\u{e759}',
|
"gemspec" => '\u{e21e}', //
|
||||||
"scala" => '\u{e737}',
|
"gform" => '\u{f298}', //
|
||||||
"shell" => '\u{f489}',
|
"gif" => '\u{f1c5}', //
|
||||||
"sqlite3" => '\u{e7c4}',
|
"git" => '\u{f1d3}', //
|
||||||
"styl" => '\u{e600}',
|
"gitattributes" => '\u{f1d3}', //
|
||||||
"latex" => '\u{e600}',
|
"gitignore" => '\u{f1d3}', //
|
||||||
"tex" => '\u{e600}',
|
"gitmodules" => '\u{f1d3}', //
|
||||||
"ts" => '\u{e628}',
|
"go" => '\u{e626}', //
|
||||||
"tsx" => '\u{e628}',
|
"gradle" => '\u{e70e}', //
|
||||||
"twig" => '\u{e61c}',
|
"groovy" => '\u{e775}', //
|
||||||
"txt" => '\u{f15c}',
|
"gsheet" => '\u{f1c3}', //
|
||||||
"video" => '\u{f03d}',
|
"gslides" => '\u{f1c4}', //
|
||||||
"vim" => '\u{e62b}',
|
"guardfile" => '\u{e21e}', //
|
||||||
"xml" => '\u{e619}',
|
"gz" => '\u{f410}', //
|
||||||
"yml" => '\u{f481}',
|
"h" => '\u{f0fd}', //
|
||||||
"yaml" => '\u{f481}',
|
"hbs" => '\u{e60f}', //
|
||||||
"rar" => '\u{f410}',
|
"hpp" => '\u{f0fd}', //
|
||||||
"zip" => '\u{f410}',
|
"hs" => '\u{e777}', //
|
||||||
"bz" => '\u{f410}',
|
"htm" => '\u{f13b}', //
|
||||||
"bz2" => '\u{f410}',
|
"html" => '\u{f13b}', //
|
||||||
"xz" => '\u{f410}',
|
"hxx" => '\u{f0fd}', //
|
||||||
"taz" => '\u{f410}',
|
"ico" => '\u{f1c5}', //
|
||||||
"tbz" => '\u{f410}',
|
"image" => '\u{f1c5}', //
|
||||||
"tbz2" => '\u{f410}',
|
"iml" => '\u{e7b5}', //
|
||||||
"tz" => '\u{f410}',
|
"ini" => '\u{f17a}', //
|
||||||
"tar" => '\u{f410}',
|
"ipynb" => '\u{e606}', //
|
||||||
"tzo" => '\u{f410}',
|
"iso" => '\u{e271}', //
|
||||||
"lz" => '\u{f410}',
|
"jad" => '\u{e256}', //
|
||||||
"lzh" => '\u{f410}',
|
"jar" => '\u{e204}', //
|
||||||
"lzma" => '\u{f410}',
|
"java" => '\u{e204}', //
|
||||||
"lzo" => '\u{f410}',
|
"jpeg" => '\u{f1c5}', //
|
||||||
"gz" => '\u{f410}',
|
"jpg" => '\u{f1c5}', //
|
||||||
"deb" => '\u{e77d}',
|
"js" => '\u{e74e}', //
|
||||||
"rpm" => '\u{e7bb}',
|
"json" => '\u{e60b}', //
|
||||||
"exe" => '\u{e70f}',
|
"jsx" => '\u{e7ba}', //
|
||||||
"msi" => '\u{e70f}',
|
"ksh" => '\u{f489}', //
|
||||||
"dll" => '\u{e70f}',
|
"latex" => '\u{e600}', //
|
||||||
"cab" => '\u{e70f}',
|
"less" => '\u{e758}', //
|
||||||
"bat" => '\u{e70f}',
|
"lhs" => '\u{e777}', //
|
||||||
"cmd" => '\u{e70f}',
|
"license" => '\u{f718}', //
|
||||||
"sh" => '\u{f489}',
|
"localized" => '\u{f179}', //
|
||||||
"bash" => '\u{f489}',
|
"lock" => '\u{f023}', //
|
||||||
"zsh" => '\u{f489}',
|
"log" => '\u{f18d}', //
|
||||||
"fish" => '\u{f489}',
|
"lua" => '\u{e620}', //
|
||||||
"csh" => '\u{f489}',
|
"lz" => '\u{f410}', //
|
||||||
"ini" => '\u{e615}',
|
"lzh" => '\u{f410}', //
|
||||||
"toml" => '\u{e615}',
|
"lzma" => '\u{f410}', //
|
||||||
"cfg" => '\u{e615}',
|
"lzo" => '\u{f410}', //
|
||||||
"conf" => '\u{e615}',
|
"m" => '\u{e61e}', //
|
||||||
"apk" => '\u{e70e}',
|
"mm" => '\u{e61d}', //
|
||||||
"ttf" => '\u{f031}',
|
"m4a" => '\u{f001}', //
|
||||||
"woff" => '\u{f031}',
|
"markdown" => '\u{f48a}', //
|
||||||
"woff2" => '\u{f031}',
|
"md" => '\u{f48a}', //
|
||||||
"otf" => '\u{f031}',
|
"mjs" => '\u{e74e}', //
|
||||||
"csv" => '\u{f1c3}',
|
"mkd" => '\u{f48a}', //
|
||||||
"tsv" => '\u{f1c3}',
|
"mkv" => '\u{f03d}', //
|
||||||
"xls" => '\u{f1c3}',
|
"mobi" => '\u{e28b}', //
|
||||||
"xlsx" => '\u{f1c3}',
|
"mov" => '\u{f03d}', //
|
||||||
"ods" => '\u{f1c3}',
|
"mp3" => '\u{f001}', //
|
||||||
"so" => '\u{f17c}',
|
"mp4" => '\u{f03d}', //
|
||||||
"sql" => '\u{f1c0}',
|
"msi" => '\u{e70f}', //
|
||||||
"jar" => '\u{e256}',
|
"mustache" => '\u{e60f}', //
|
||||||
"jad" => '\u{e256}',
|
"nix" => '\u{f313}', //
|
||||||
"class" => '\u{e256}',
|
"node" => '\u{f898}', //
|
||||||
"war" => '\u{e256}',
|
"npmignore" => '\u{e71e}', //
|
||||||
"groovy" => '\u{e775}',
|
"odp" => '\u{f1c4}', //
|
||||||
"iso" => '\u{e271}',
|
"ods" => '\u{f1c3}', //
|
||||||
"lock" => '\u{f023}',
|
"odt" => '\u{f1c2}', //
|
||||||
"swift" => '\u{e755}',
|
"ogg" => '\u{f001}', //
|
||||||
"nix" => '\u{f313}',
|
"ogv" => '\u{f03d}', //
|
||||||
_ => '\u{f016}'
|
"otf" => '\u{f031}', //
|
||||||
|
"patch" => '\u{f440}', //
|
||||||
|
"pdf" => '\u{f1c1}', //
|
||||||
|
"php" => '\u{e73d}', //
|
||||||
|
"pl" => '\u{e769}', //
|
||||||
|
"png" => '\u{f1c5}', //
|
||||||
|
"ppt" => '\u{f1c4}', //
|
||||||
|
"pptx" => '\u{f1c4}', //
|
||||||
|
"procfile" => '\u{e21e}', //
|
||||||
|
"properties" => '\u{e60b}', //
|
||||||
|
"ps1" => '\u{f489}', //
|
||||||
|
"psd" => '\u{e7b8}', //
|
||||||
|
"pxm" => '\u{f1c5}', //
|
||||||
|
"py" => '\u{e606}', //
|
||||||
|
"pyc" => '\u{e606}', //
|
||||||
|
"r" => '\u{f25d}', //
|
||||||
|
"rakefile" => '\u{e21e}', //
|
||||||
|
"rar" => '\u{f410}', //
|
||||||
|
"razor" => '\u{f1fa}', //
|
||||||
|
"rb" => '\u{e21e}', //
|
||||||
|
"rdata" => '\u{f25d}', //
|
||||||
|
"rdb" => '\u{e76d}', //
|
||||||
|
"rdoc" => '\u{f48a}', //
|
||||||
|
"rds" => '\u{f25d}', //
|
||||||
|
"readme" => '\u{f48a}', //
|
||||||
|
"rlib" => '\u{e7a8}', //
|
||||||
|
"rmd" => '\u{f48a}', //
|
||||||
|
"rpm" => '\u{e7bb}', //
|
||||||
|
"rs" => '\u{e7a8}', //
|
||||||
|
"rspec" => '\u{e21e}', //
|
||||||
|
"rspec_parallel"=> '\u{e21e}', //
|
||||||
|
"rspec_status" => '\u{e21e}', //
|
||||||
|
"rss" => '\u{f09e}', //
|
||||||
|
"rtf" => '\u{f718}', //
|
||||||
|
"ru" => '\u{e21e}', //
|
||||||
|
"rubydoc" => '\u{e73b}', //
|
||||||
|
"sass" => '\u{e603}', //
|
||||||
|
"scala" => '\u{e737}', //
|
||||||
|
"scss" => '\u{e749}', //
|
||||||
|
"sh" => '\u{f489}', //
|
||||||
|
"shell" => '\u{f489}', //
|
||||||
|
"slim" => '\u{e73b}', //
|
||||||
|
"sln" => '\u{e70c}', //
|
||||||
|
"so" => '\u{f17c}', //
|
||||||
|
"sql" => '\u{f1c0}', //
|
||||||
|
"sqlite3" => '\u{e7c4}', //
|
||||||
|
"styl" => '\u{e600}', //
|
||||||
|
"stylus" => '\u{e600}', //
|
||||||
|
"svg" => '\u{f1c5}', //
|
||||||
|
"swift" => '\u{e755}', //
|
||||||
|
"tar" => '\u{f410}', //
|
||||||
|
"taz" => '\u{f410}', //
|
||||||
|
"tbz" => '\u{f410}', //
|
||||||
|
"tbz2" => '\u{f410}', //
|
||||||
|
"tex" => '\u{e600}', //
|
||||||
|
"tiff" => '\u{f1c5}', //
|
||||||
|
"toml" => '\u{e615}', //
|
||||||
|
"ts" => '\u{e628}', //
|
||||||
|
"tsv" => '\u{f1c3}', //
|
||||||
|
"tsx" => '\u{e7ba}', //
|
||||||
|
"ttf" => '\u{f031}', //
|
||||||
|
"twig" => '\u{e61c}', //
|
||||||
|
"txt" => '\u{f15c}', //
|
||||||
|
"tz" => '\u{f410}', //
|
||||||
|
"tzo" => '\u{f410}', //
|
||||||
|
"video" => '\u{f03d}', //
|
||||||
|
"vim" => '\u{e62b}', //
|
||||||
|
"vue" => '\u{fd42}', // ﵂
|
||||||
|
"war" => '\u{e256}', //
|
||||||
|
"wav" => '\u{f001}', //
|
||||||
|
"webm" => '\u{f03d}', //
|
||||||
|
"webp" => '\u{f1c5}', //
|
||||||
|
"windows" => '\u{f17a}', //
|
||||||
|
"woff" => '\u{f031}', //
|
||||||
|
"woff2" => '\u{f031}', //
|
||||||
|
"xhtml" => '\u{f13b}', //
|
||||||
|
"xls" => '\u{f1c3}', //
|
||||||
|
"xlsx" => '\u{f1c3}', //
|
||||||
|
"xml" => '\u{fabf}', // 謹
|
||||||
|
"xul" => '\u{fabf}', // 謹
|
||||||
|
"xz" => '\u{f410}', //
|
||||||
|
"yaml" => '\u{f481}', //
|
||||||
|
"yml" => '\u{f481}', //
|
||||||
|
"zip" => '\u{f410}', //
|
||||||
|
"zsh" => '\u{f489}', //
|
||||||
|
"zsh-theme" => '\u{f489}', //
|
||||||
|
"zshrc" => '\u{f489}', //
|
||||||
|
_ => '\u{f15b}' //
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -3,6 +3,7 @@ use std::io::{self, Write};
|
|||||||
use ansi_term::ANSIStrings;
|
use ansi_term::ANSIStrings;
|
||||||
|
|
||||||
use crate::fs::File;
|
use crate::fs::File;
|
||||||
|
use crate::fs::filter::FileFilter;
|
||||||
use crate::output::cell::TextCellContents;
|
use crate::output::cell::TextCellContents;
|
||||||
use crate::output::file_name::{Options as FileStyle};
|
use crate::output::file_name::{Options as FileStyle};
|
||||||
use crate::theme::Theme;
|
use crate::theme::Theme;
|
||||||
@ -13,10 +14,12 @@ pub struct Render<'a> {
|
|||||||
pub files: Vec<File<'a>>,
|
pub files: Vec<File<'a>>,
|
||||||
pub theme: &'a Theme,
|
pub theme: &'a Theme,
|
||||||
pub file_style: &'a FileStyle,
|
pub file_style: &'a FileStyle,
|
||||||
|
pub filter: &'a FileFilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Render<'a> {
|
impl<'a> Render<'a> {
|
||||||
pub fn render<W: Write>(&self, w: &mut W) -> io::Result<()> {
|
pub fn render<W: Write>(mut self, w: &mut W) -> io::Result<()> {
|
||||||
|
self.filter.sort_files(&mut self.files);
|
||||||
for file in &self.files {
|
for file in &self.files {
|
||||||
let name_cell = self.render_file(file);
|
let name_cell = self.render_file(file);
|
||||||
writeln!(w, "{}", ANSIStrings(&name_cell))?;
|
writeln!(w, "{}", ANSIStrings(&name_cell))?;
|
||||||
|
@ -107,7 +107,7 @@ impl Columns {
|
|||||||
columns.push(Column::Timestamp(TimeType::Accessed));
|
columns.push(Column::Timestamp(TimeType::Accessed));
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(feature = "git") && self.git && actually_enable_git {
|
if self.git && actually_enable_git {
|
||||||
columns.push(Column::GitStatus);
|
columns.push(Column::GitStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,7 @@ tags = [ 'env', 'grid' ]
|
|||||||
|
|
||||||
|
|
||||||
# columns and width tests with files
|
# columns and width tests with files
|
||||||
# (these rely on bash’s glob sort order)
|
# (warning: some of the output files have trailing whitespace)
|
||||||
# (some of the output files also have trailing whitespace)
|
|
||||||
|
|
||||||
[[cmd]]
|
[[cmd]]
|
||||||
name = "‘COLUMNS=100 exa’ with file arguments produces a grid of 3 columns, with full paths"
|
name = "‘COLUMNS=100 exa’ with file arguments produces a grid of 3 columns, with full paths"
|
||||||
|
6
xtests/outputs/exts_grid_sort_name_reverse.ansitxt
Normal file
6
xtests/outputs/exts_grid_sort_name_reverse.ansitxt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[38;5;135mvideo.wmv[0m [38;5;93mlossless.flac[0m [38;5;109mcrypto.signature[0m [31mcompressed.tar.gz[0m [38;5;244mbackup~[0m
|
||||||
|
[38;5;135mVIDEO.AVI[0m [38;5;133mimage.svg[0m [38;5;109mcrypto.asc[0m [31mcompressed.deb[0m [38;5;244m#SAVEFILE#[0m
|
||||||
|
[38;5;92mMUSIC.OGG[0m [38;5;133mIMAGE.PNG[0m [31mCOMPRESSED.ZIP[0m [38;5;137mcompiled.o[0m
|
||||||
|
[38;5;92mmusic.mp3[0m [38;5;244mfile.tmp[0m [31mcompressed.txz[0m compiled.js
|
||||||
|
[1;4;33mMakefile[0m [38;5;105mDOCUMENT.XLSX[0m [31mcompressed.tgz[0m compiled.coffee
|
||||||
|
[38;5;93mlossless.wav[0m [38;5;105mdocument.pdf[0m [31mcompressed.tar.xz[0m [38;5;137mcompiled.class[0m
|
26
xtests/outputs/exts_oneline_sort_name_reverse.ansitxt
Normal file
26
xtests/outputs/exts_oneline_sort_name_reverse.ansitxt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
[38;5;135mvideo.wmv[0m
|
||||||
|
[38;5;135mVIDEO.AVI[0m
|
||||||
|
[38;5;92mMUSIC.OGG[0m
|
||||||
|
[38;5;92mmusic.mp3[0m
|
||||||
|
[1;4;33mMakefile[0m
|
||||||
|
[38;5;93mlossless.wav[0m
|
||||||
|
[38;5;93mlossless.flac[0m
|
||||||
|
[38;5;133mimage.svg[0m
|
||||||
|
[38;5;133mIMAGE.PNG[0m
|
||||||
|
[38;5;244mfile.tmp[0m
|
||||||
|
[38;5;105mDOCUMENT.XLSX[0m
|
||||||
|
[38;5;105mdocument.pdf[0m
|
||||||
|
[38;5;109mcrypto.signature[0m
|
||||||
|
[38;5;109mcrypto.asc[0m
|
||||||
|
[31mCOMPRESSED.ZIP[0m
|
||||||
|
[31mcompressed.txz[0m
|
||||||
|
[31mcompressed.tgz[0m
|
||||||
|
[31mcompressed.tar.xz[0m
|
||||||
|
[31mcompressed.tar.gz[0m
|
||||||
|
[31mcompressed.deb[0m
|
||||||
|
[38;5;137mcompiled.o[0m
|
||||||
|
compiled.js
|
||||||
|
compiled.coffee
|
||||||
|
[38;5;137mcompiled.class[0m
|
||||||
|
[38;5;244mbackup~[0m
|
||||||
|
[38;5;244m#SAVEFILE#[0m
|
@ -1,13 +1,13 @@
|
|||||||
[36m/testcases/files/[0m10_bytes [36m/testcases/files/[0m1_KiB [36m/testcases/files/[0m5_MiB
|
[36m/testcases/files/[0m1_bytes [36m/testcases/files/[0m5_KiB [36m/testcases/files/[0m9_MiB
|
||||||
[36m/testcases/files/[0m10_KiB [36m/testcases/files/[0m1_MiB [36m/testcases/files/[0m6_bytes
|
[36m/testcases/files/[0m1_KiB [36m/testcases/files/[0m5_MiB [36m/testcases/files/[0m10_bytes
|
||||||
[36m/testcases/files/[0m10_MiB [36m/testcases/files/[0m2_bytes [36m/testcases/files/[0m6_KiB
|
[36m/testcases/files/[0m1_MiB [36m/testcases/files/[0m6_bytes [36m/testcases/files/[0m10_KiB
|
||||||
[36m/testcases/files/[0m11_bytes [36m/testcases/files/[0m2_KiB [36m/testcases/files/[0m6_MiB
|
[36m/testcases/files/[0m2_bytes [36m/testcases/files/[0m6_KiB [36m/testcases/files/[0m10_MiB
|
||||||
[36m/testcases/files/[0m11_KiB [36m/testcases/files/[0m2_MiB [36m/testcases/files/[0m7_bytes
|
[36m/testcases/files/[0m2_KiB [36m/testcases/files/[0m6_MiB [36m/testcases/files/[0m11_bytes
|
||||||
[36m/testcases/files/[0m11_MiB [36m/testcases/files/[0m3_bytes [36m/testcases/files/[0m7_KiB
|
[36m/testcases/files/[0m2_MiB [36m/testcases/files/[0m7_bytes [36m/testcases/files/[0m11_KiB
|
||||||
[36m/testcases/files/[0m12_bytes [36m/testcases/files/[0m3_KiB [36m/testcases/files/[0m7_MiB
|
[36m/testcases/files/[0m3_bytes [36m/testcases/files/[0m7_KiB [36m/testcases/files/[0m11_MiB
|
||||||
[36m/testcases/files/[0m12_KiB [36m/testcases/files/[0m3_MiB [36m/testcases/files/[0m8_bytes
|
[36m/testcases/files/[0m3_KiB [36m/testcases/files/[0m7_MiB [36m/testcases/files/[0m12_bytes
|
||||||
[36m/testcases/files/[0m12_MiB [36m/testcases/files/[0m4_bytes [36m/testcases/files/[0m8_KiB
|
[36m/testcases/files/[0m3_MiB [36m/testcases/files/[0m8_bytes [36m/testcases/files/[0m12_KiB
|
||||||
[36m/testcases/files/[0m13_bytes [36m/testcases/files/[0m4_KiB [36m/testcases/files/[0m8_MiB
|
[36m/testcases/files/[0m4_bytes [36m/testcases/files/[0m8_KiB [36m/testcases/files/[0m12_MiB
|
||||||
[36m/testcases/files/[0m13_KiB [36m/testcases/files/[0m4_MiB [36m/testcases/files/[0m9_bytes
|
[36m/testcases/files/[0m4_KiB [36m/testcases/files/[0m8_MiB [36m/testcases/files/[0m13_bytes
|
||||||
[36m/testcases/files/[0m13_MiB [36m/testcases/files/[0m5_bytes [36m/testcases/files/[0m9_KiB
|
[36m/testcases/files/[0m4_MiB [36m/testcases/files/[0m9_bytes [36m/testcases/files/[0m13_KiB
|
||||||
[36m/testcases/files/[0m1_bytes [36m/testcases/files/[0m5_KiB [36m/testcases/files/[0m9_MiB
|
[36m/testcases/files/[0m5_bytes [36m/testcases/files/[0m9_KiB [36m/testcases/files/[0m13_MiB
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[36m/testcases/files/[0m10_bytes [36m/testcases/files/[0m12_MiB [36m/testcases/files/[0m2_KiB [36m/testcases/files/[0m5_bytes [36m/testcases/files/[0m7_MiB
|
[36m/testcases/files/[0m1_bytes [36m/testcases/files/[0m3_MiB [36m/testcases/files/[0m6_KiB [36m/testcases/files/[0m9_bytes [36m/testcases/files/[0m11_MiB
|
||||||
[36m/testcases/files/[0m10_KiB [36m/testcases/files/[0m13_bytes [36m/testcases/files/[0m2_MiB [36m/testcases/files/[0m5_KiB [36m/testcases/files/[0m8_bytes
|
[36m/testcases/files/[0m1_KiB [36m/testcases/files/[0m4_bytes [36m/testcases/files/[0m6_MiB [36m/testcases/files/[0m9_KiB [36m/testcases/files/[0m12_bytes
|
||||||
[36m/testcases/files/[0m10_MiB [36m/testcases/files/[0m13_KiB [36m/testcases/files/[0m3_bytes [36m/testcases/files/[0m5_MiB [36m/testcases/files/[0m8_KiB
|
[36m/testcases/files/[0m1_MiB [36m/testcases/files/[0m4_KiB [36m/testcases/files/[0m7_bytes [36m/testcases/files/[0m9_MiB [36m/testcases/files/[0m12_KiB
|
||||||
[36m/testcases/files/[0m11_bytes [36m/testcases/files/[0m13_MiB [36m/testcases/files/[0m3_KiB [36m/testcases/files/[0m6_bytes [36m/testcases/files/[0m8_MiB
|
[36m/testcases/files/[0m2_bytes [36m/testcases/files/[0m4_MiB [36m/testcases/files/[0m7_KiB [36m/testcases/files/[0m10_bytes [36m/testcases/files/[0m12_MiB
|
||||||
[36m/testcases/files/[0m11_KiB [36m/testcases/files/[0m1_bytes [36m/testcases/files/[0m3_MiB [36m/testcases/files/[0m6_KiB [36m/testcases/files/[0m9_bytes
|
[36m/testcases/files/[0m2_KiB [36m/testcases/files/[0m5_bytes [36m/testcases/files/[0m7_MiB [36m/testcases/files/[0m10_KiB [36m/testcases/files/[0m13_bytes
|
||||||
[36m/testcases/files/[0m11_MiB [36m/testcases/files/[0m1_KiB [36m/testcases/files/[0m4_bytes [36m/testcases/files/[0m6_MiB [36m/testcases/files/[0m9_KiB
|
[36m/testcases/files/[0m2_MiB [36m/testcases/files/[0m5_KiB [36m/testcases/files/[0m8_bytes [36m/testcases/files/[0m10_MiB [36m/testcases/files/[0m13_KiB
|
||||||
[36m/testcases/files/[0m12_bytes [36m/testcases/files/[0m1_MiB [36m/testcases/files/[0m4_KiB [36m/testcases/files/[0m7_bytes [36m/testcases/files/[0m9_MiB
|
[36m/testcases/files/[0m3_bytes [36m/testcases/files/[0m5_MiB [36m/testcases/files/[0m8_KiB [36m/testcases/files/[0m11_bytes [36m/testcases/files/[0m13_MiB
|
||||||
[36m/testcases/files/[0m12_KiB [36m/testcases/files/[0m2_bytes [36m/testcases/files/[0m4_MiB [36m/testcases/files/[0m7_KiB
|
[36m/testcases/files/[0m3_KiB [36m/testcases/files/[0m6_bytes [36m/testcases/files/[0m8_MiB [36m/testcases/files/[0m11_KiB
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[36m/testcases/files/[0m10_bytes [36m/testcases/files/[0m12_bytes [36m/testcases/files/[0m1_bytes [36m/testcases/files/[0m3_bytes [36m/testcases/files/[0m5_bytes [36m/testcases/files/[0m7_bytes [36m/testcases/files/[0m9_bytes
|
[36m/testcases/files/[0m1_bytes [36m/testcases/files/[0m3_bytes [36m/testcases/files/[0m5_bytes [36m/testcases/files/[0m7_bytes [36m/testcases/files/[0m9_bytes [36m/testcases/files/[0m11_bytes [36m/testcases/files/[0m13_bytes
|
||||||
[36m/testcases/files/[0m10_KiB [36m/testcases/files/[0m12_KiB [36m/testcases/files/[0m1_KiB [36m/testcases/files/[0m3_KiB [36m/testcases/files/[0m5_KiB [36m/testcases/files/[0m7_KiB [36m/testcases/files/[0m9_KiB
|
[36m/testcases/files/[0m1_KiB [36m/testcases/files/[0m3_KiB [36m/testcases/files/[0m5_KiB [36m/testcases/files/[0m7_KiB [36m/testcases/files/[0m9_KiB [36m/testcases/files/[0m11_KiB [36m/testcases/files/[0m13_KiB
|
||||||
[36m/testcases/files/[0m10_MiB [36m/testcases/files/[0m12_MiB [36m/testcases/files/[0m1_MiB [36m/testcases/files/[0m3_MiB [36m/testcases/files/[0m5_MiB [36m/testcases/files/[0m7_MiB [36m/testcases/files/[0m9_MiB
|
[36m/testcases/files/[0m1_MiB [36m/testcases/files/[0m3_MiB [36m/testcases/files/[0m5_MiB [36m/testcases/files/[0m7_MiB [36m/testcases/files/[0m9_MiB [36m/testcases/files/[0m11_MiB [36m/testcases/files/[0m13_MiB
|
||||||
[36m/testcases/files/[0m11_bytes [36m/testcases/files/[0m13_bytes [36m/testcases/files/[0m2_bytes [36m/testcases/files/[0m4_bytes [36m/testcases/files/[0m6_bytes [36m/testcases/files/[0m8_bytes
|
[36m/testcases/files/[0m2_bytes [36m/testcases/files/[0m4_bytes [36m/testcases/files/[0m6_bytes [36m/testcases/files/[0m8_bytes [36m/testcases/files/[0m10_bytes [36m/testcases/files/[0m12_bytes
|
||||||
[36m/testcases/files/[0m11_KiB [36m/testcases/files/[0m13_KiB [36m/testcases/files/[0m2_KiB [36m/testcases/files/[0m4_KiB [36m/testcases/files/[0m6_KiB [36m/testcases/files/[0m8_KiB
|
[36m/testcases/files/[0m2_KiB [36m/testcases/files/[0m4_KiB [36m/testcases/files/[0m6_KiB [36m/testcases/files/[0m8_KiB [36m/testcases/files/[0m10_KiB [36m/testcases/files/[0m12_KiB
|
||||||
[36m/testcases/files/[0m11_MiB [36m/testcases/files/[0m13_MiB [36m/testcases/files/[0m2_MiB [36m/testcases/files/[0m4_MiB [36m/testcases/files/[0m6_MiB [36m/testcases/files/[0m8_MiB
|
[36m/testcases/files/[0m2_MiB [36m/testcases/files/[0m4_MiB [36m/testcases/files/[0m6_MiB [36m/testcases/files/[0m8_MiB [36m/testcases/files/[0m10_MiB [36m/testcases/files/[0m12_MiB
|
||||||
|
@ -136,3 +136,22 @@ stdout = { string = "plum\npear\npeach" }
|
|||||||
stderr = { empty = true }
|
stderr = { empty = true }
|
||||||
status = 0
|
status = 0
|
||||||
tags = [ 'oneline', 'sort', 'dates' ]
|
tags = [ 'oneline', 'sort', 'dates' ]
|
||||||
|
|
||||||
|
# sorting with arguments specified
|
||||||
|
|
||||||
|
[[cmd]]
|
||||||
|
name = "‘exa -G --sort=name -r’ with file arguments sorts by file name in reverse order"
|
||||||
|
shell = "cd /testcases/file-names-exts; exa -G --sort=name -r *"
|
||||||
|
environment = { COLUMNS = "80" }
|
||||||
|
stdout = { file = "outputs/exts_grid_sort_name_reverse.ansitxt" }
|
||||||
|
stderr = { empty = true }
|
||||||
|
status = 0
|
||||||
|
tags = [ 'grid', 'sort', 'reverse' ]
|
||||||
|
|
||||||
|
[[cmd]]
|
||||||
|
name = "‘exa -1 --sort=name -r’ with file arguments sorts by file name in reverse order"
|
||||||
|
shell = "cd /testcases/file-names-exts; exa -1 --sort=name -r *"
|
||||||
|
stdout = { file = "outputs/exts_oneline_sort_name_reverse.ansitxt" }
|
||||||
|
stderr = { empty = true }
|
||||||
|
status = 0
|
||||||
|
tags = [ 'oneline', 'sort', 'reverse' ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user