Skip to content

Commit

Permalink
fix: -f work with -T option output empty
Browse files Browse the repository at this point in the history
  • Loading branch information
wugeer committed Oct 25, 2024
1 parent ab57f46 commit 63e925a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
12 changes: 2 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use std::process::exit;
use nu_ansi_term::{AnsiStrings as ANSIStrings, Style};

use crate::fs::feature::git::GitCache;
use crate::fs::filter::{FileFilterFlags::OnlyFiles, GitIgnore};
use crate::fs::filter::GitIgnore;
use crate::fs::{Dir, File};
use crate::options::stdin::FilesInput;
use crate::options::{vars, Options, OptionsResult, Vars};
Expand Down Expand Up @@ -395,18 +395,10 @@ impl<'args> Exa<'args> {
}

/// Prints the list of files using whichever view is selected.
fn print_files(&mut self, dir: Option<&Dir>, mut files: Vec<File<'_>>) -> io::Result<()> {
fn print_files(&mut self, dir: Option<&Dir>, files: Vec<File<'_>>) -> io::Result<()> {
if files.is_empty() {
return Ok(());
}
let recursing = self.options.dir_action.recurse_options().is_some();
let only_files = self.options.filter.flags.contains(&OnlyFiles);
if recursing && only_files {
files = files
.into_iter()
.filter(|f| !f.is_directory())
.collect::<Vec<_>>();
}
let theme = &self.theme;
let View {
ref mode,
Expand Down
38 changes: 20 additions & 18 deletions src/output/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ use crate::fs::dir_action::RecurseOptions;
use crate::fs::feature::git::GitCache;
use crate::fs::feature::xattr::Attribute;
use crate::fs::fields::SecurityContextType;
use crate::fs::filter::FileFilter;
use crate::fs::filter::{FileFilter, FileFilterFlags::OnlyFiles};
use crate::fs::{Dir, File};
use crate::output::cell::TextCell;
use crate::output::color_scale::{ColorScaleInformation, ColorScaleOptions};
Expand Down Expand Up @@ -332,27 +332,29 @@ impl<'a> Render<'a> {
let mut files = Vec::new();
let errors = egg.errors;

if let (Some(ref mut t), Some(row)) = (table.as_mut(), egg.table_row.as_ref()) {
t.add_widths(row);
}
if !(egg.file.path.is_dir() && self.filter.flags.contains(&OnlyFiles)) {
if let (Some(ref mut t), Some(row)) = (table.as_mut(), egg.table_row.as_ref()) {
t.add_widths(row);
}

let file_name = self
.file_style
.for_file(egg.file, self.theme)
.with_link_paths()
.with_mount_details(self.opts.mounts)
.paint()
.promote();
let file_name = self
.file_style
.for_file(egg.file, self.theme)
.with_link_paths()
.with_mount_details(self.opts.mounts)
.paint()
.promote();

debug!("file_name {:?}", file_name);
debug!("file_name {:?}", file_name);

let row = Row {
tree: tree_params,
cells: egg.table_row,
name: file_name,
};
let row = Row {
tree: tree_params,
cells: egg.table_row,
name: file_name,
};

rows.push(row);
rows.push(row);
}

if let Some(ref dir) = egg.dir {
for file_to_add in dir.files(
Expand Down

0 comments on commit 63e925a

Please sign in to comment.