Skip to content

Commit

Permalink
Merge pull request #32 from cafkafk/pr-1136
Browse files Browse the repository at this point in the history
(exa PR) 1136: Fix #393: add flag to dereference links
  • Loading branch information
cafkafk authored Jul 31, 2023
2 parents 8df8e8f + 0397d5d commit 5564772
Show file tree
Hide file tree
Showing 17 changed files with 349 additions and 179 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ These options are available when running with `--long` (`-l`):
- **-t**, **--time=(field)**: which timestamp field to use
- **-u**, **--accessed**: use the accessed timestamp field
- **-U**, **--created**: use the created timestamp field
- **-X**, **--dereference**: dereference symlinks for file information
- **-Z**, **--context**: list each file’s security context
- **-@**, **--extended**: list each file’s extended attributes and sizes
- **--changed**: use the changed timestamp field
Expand Down
99 changes: 50 additions & 49 deletions completions/fish/eza.fish
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Meta-stuff
complete -c eza -s 'v' -l 'version' -d "Show version of eza"
complete -c eza -s '?' -l 'help' -d "Show list of command-line options"
complete -c eza -s v -l version -d "Show version of eza"
complete -c eza -s '?' -l help -d "Show list of command-line options"

# Display options
complete -c eza -s '1' -l 'oneline' -d "Display one entry per line"
complete -c eza -s 'l' -l 'long' -d "Display extended file metadata as a table"
complete -c eza -s 'G' -l 'grid' -d "Display entries in a grid"
complete -c eza -s 'x' -l 'across' -d "Sort the grid across, rather than downwards"
complete -c eza -s 'R' -l 'recurse' -d "Recurse into directories"
complete -c eza -s 'T' -l 'tree' -d "Recurse into directories as a tree"
complete -c eza -s 'F' -l 'classify' -d "Display type indicator by file names"
complete -c eza -l 'color' \
-l 'colour' -d "When to use terminal colours" -x -a "
complete -c eza -s 1 -l oneline -d "Display one entry per line"
complete -c eza -s l -l long -d "Display extended file metadata as a table"
complete -c eza -s G -l grid -d "Display entries in a grid"
complete -c eza -s x -l across -d "Sort the grid across, rather than downwards"
complete -c eza -s R -l recurse -d "Recurse into directories"
complete -c eza -s T -l tree -d "Recurse into directories as a tree"
complete -c eza -s F -l classify -d "Display type indicator by file names"
complete -c eza -l color \
-l colour -d "When to use terminal colours" -x -a "
always\t'Always use colour'
auto\t'Use colour if standard output is a terminal'
never\t'Never use colour'
"
complete -c eza -l 'color-scale' \
-l 'colour-scale' -d "Highlight levels of file sizes distinctly"
complete -c eza -l 'icons' -d "Display icons"
complete -c eza -l 'no-icons' -d "Don't display icons"
complete -c eza -l 'hyperlink' -d "Display entries as hyperlinks"
complete -c eza -l color-scale \
-l colour-scale -d "Highlight levels of file sizes distinctly"
complete -c eza -l icons -d "Display icons"
complete -c eza -l no-icons -d "Don't display icons"
complete -c eza -l hyperlink -d "Display entries as hyperlinks"

# Filtering and sorting options
complete -c eza -l 'group-directories-first' -d "Sort directories before other files"
complete -c eza -l 'git-ignore' -d "Ignore files mentioned in '.gitignore'"
complete -c eza -s 'a' -l 'all' -d "Show hidden and 'dot' files"
complete -c eza -s 'd' -l 'list-dirs' -d "List directories like regular files"
complete -c eza -s 'L' -l 'level' -d "Limit the depth of recursion" -x -a "1 2 3 4 5 6 7 8 9"
complete -c eza -s 'r' -l 'reverse' -d "Reverse the sort order"
complete -c eza -s 's' -l 'sort' -d "Which field to sort by" -x -a "
complete -c eza -l group-directories-first -d "Sort directories before other files"
complete -c eza -l git-ignore -d "Ignore files mentioned in '.gitignore'"
complete -c eza -s a -l all -d "Show hidden and 'dot' files"
complete -c eza -s d -l list-dirs -d "List directories like regular files"
complete -c eza -s L -l level -d "Limit the depth of recursion" -x -a "1 2 3 4 5 6 7 8 9"
complete -c eza -s r -l reverse -d "Reverse the sort order"
complete -c eza -s s -l sort -d "Which field to sort by" -x -a "
accessed\t'Sort by file accessed time'
age\t'Sort by file modified time (newest first)'
changed\t'Sort by changed time'
Expand All @@ -53,44 +53,45 @@ complete -c eza -s 's' -l 'sort' -d "Which field to sort by" -x -a "
type\t'Sort by file type'
"

complete -c eza -s 'I' -l 'ignore-glob' -d "Ignore files that match these glob patterns" -r
complete -c eza -s 'D' -l 'only-dirs' -d "List only directories"
complete -c eza -s I -l ignore-glob -d "Ignore files that match these glob patterns" -r
complete -c eza -s D -l only-dirs -d "List only directories"

# Long view options
complete -c eza -s 'b' -l 'binary' -d "List file sizes with binary prefixes"
complete -c eza -s 'B' -l 'bytes' -d "List file sizes in bytes, without any prefixes"
complete -c eza -s 'g' -l 'group' -d "List each file's group"
complete -c eza -s 'h' -l 'header' -d "Add a header row to each column"
complete -c eza -s 'H' -l 'links' -d "List each file's number of hard links"
complete -c eza -s 'i' -l 'inode' -d "List each file's inode number"
complete -c eza -s 'S' -l 'blocks' -d "List each file's number of filesystem blocks"
complete -c eza -s 't' -l 'time' -d "Which timestamp field to list" -x -a "
complete -c eza -s b -l binary -d "List file sizes with binary prefixes"
complete -c eza -s B -l bytes -d "List file sizes in bytes, without any prefixes"
complete -c eza -s g -l group -d "List each file's group"
complete -c eza -s h -l header -d "Add a header row to each column"
complete -c eza -s H -l links -d "List each file's number of hard links"
complete -c eza -s i -l inode -d "List each file's inode number"
complete -c eza -s S -l blocks -d "List each file's number of filesystem blocks"
complete -c eza -s t -l time -d "Which timestamp field to list" -x -a "
modified\t'Display modified time'
changed\t'Display changed time'
accessed\t'Display accessed time'
created\t'Display created time'
"
complete -c eza -s 'm' -l 'modified' -d "Use the modified timestamp field"
complete -c eza -s 'n' -l 'numeric' -d "List numeric user and group IDs."
complete -c eza -l 'changed' -d "Use the changed timestamp field"
complete -c eza -s 'u' -l 'accessed' -d "Use the accessed timestamp field"
complete -c eza -s 'U' -l 'created' -d "Use the created timestamp field"
complete -c eza -l 'time-style' -d "How to format timestamps" -x -a "
complete -c exa -s X -l dereference -d "dereference symlinks for file information"
complete -c eza -s m -l modified -d "Use the modified timestamp field"
complete -c eza -s n -l numeric -d "List numeric user and group IDs."
complete -c eza -l changed -d "Use the changed timestamp field"
complete -c eza -s u -l accessed -d "Use the accessed timestamp field"
complete -c eza -s U -l created -d "Use the created timestamp field"
complete -c eza -l time-style -d "How to format timestamps" -x -a "
default\t'Use the default time style'
iso\t'Display brief ISO timestamps'
long-iso\t'Display longer ISO timestaps, up to the minute'
full-iso\t'Display full ISO timestamps, up to the nanosecond'
relative\t'Display relative timestamps'
"
complete -c eza -l 'no-permissions' -d "Suppress the permissions field"
complete -c eza -s 'o' -l 'octal-permissions' -d "List each file's permission in octal format"
complete -c eza -l 'no-filesize' -d "Suppress the filesize field"
complete -c eza -l 'no-user' -d "Suppress the user field"
complete -c eza -l 'no-time' -d "Suppress the time field"
complete -c eza -l no-permissions -d "Suppress the permissions field"
complete -c eza -s o -l octal-permissions -d "List each file's permission in octal format"
complete -c eza -l no-filesize -d "Suppress the filesize field"
complete -c eza -l no-user -d "Suppress the user field"
complete -c eza -l no-time -d "Suppress the time field"

# Optional extras
complete -c eza -l 'git' -d "List each file's Git status, if tracked"
complete -c eza -l 'git-repos' -d "List each git-repos status and branch name"
complete -c eza -l 'git-repos-no-status' -d "List each git-repos branch name (much faster)"
complete -c eza -s '@' -l 'extended' -d "List each file's extended attributes and sizes"
complete -c eza -s 'Z' -l 'context' -d "List each file's security context"
complete -c eza -l git -d "List each file's Git status, if tracked"
complete -c eza -l git-repos -d "List each git-repos status and branch name"
complete -c eza -l git-repos-no-status -d "List each git-repos branch name (much faster)"
complete -c eza -s '@' -l extended -d "List each file's extended attributes and sizes"
complete -c eza -s Z -l context -d "List each file's security context"
1 change: 1 addition & 0 deletions completions/zsh/_eza
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ __eza() {
--no-time"[Suppress the time field]" \
{-u,--accessed}"[Use the accessed timestamp field]" \
{-U,--created}"[Use the created timestamp field]" \
{-X,--dereference}"[dereference symlinks for file information]" \
--git"[List each file's Git status, if tracked]" \
--git-repos"[List each git-repos status and branch name]" \
--git-repos-no-status"[List each git-repos branch name (much faster)]" \
Expand Down
8 changes: 6 additions & 2 deletions src/fs/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ impl Dir {

/// Produce an iterator of IO results of trying to read all the files in
/// this directory.
pub fn files<'dir, 'ig>(&'dir self, dots: DotFilter, git: Option<&'ig GitCache>, git_ignoring: bool) -> Files<'dir, 'ig> {
pub fn files<'dir, 'ig>(&'dir self, dots: DotFilter, git: Option<&'ig GitCache>, git_ignoring: bool, deref_links: bool) -> Files<'dir, 'ig> {
Files {
inner: self.contents.iter(),
dir: self,
dotfiles: dots.shows_dotfiles(),
dots: dots.dots(),
git,
git_ignoring,
deref_links,
}
}

Expand Down Expand Up @@ -89,6 +90,9 @@ pub struct Files<'dir, 'ig> {
git: Option<&'ig GitCache>,

git_ignoring: bool,

/// Whether symbolic links should be dereferenced when querying information.
deref_links: bool,
}

impl<'dir, 'ig> Files<'dir, 'ig> {
Expand Down Expand Up @@ -125,7 +129,7 @@ impl<'dir, 'ig> Files<'dir, 'ig> {
}
}

return Some(File::from_args(path.clone(), self.dir, filename)
return Some(File::from_args(path.clone(), self.dir, filename, self.deref_links)
.map_err(|e| (path.clone(), e)))
}

Expand Down
Loading

0 comments on commit 5564772

Please sign in to comment.